Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
USING: formatting kernel match math pair-rocket regexp sequences ;
|
||||
|
||||
MATCH-VARS: ?a ?b ;
|
||||
|
||||
: choose-term ( coeff i -- str )
|
||||
1 + { } 2sequence {
|
||||
{ 0 _ } => [ "" ]
|
||||
{ 1 ?a } => [ ?a "e(%d)" sprintf ]
|
||||
{ -1 ?a } => [ ?a "-e(%d)" sprintf ]
|
||||
{ ?a ?b } => [ ?a ?b "%d*e(%d)" sprintf ]
|
||||
} match-cond ;
|
||||
|
||||
: linear-combo ( seq -- str )
|
||||
[ choose-term ] map-index harvest " + " join
|
||||
R/ \+ -/ "- " re-replace [ "0" ] when-empty ;
|
||||
|
||||
{ { 1 2 3 } { 0 1 2 3 } { 1 0 3 4 } { 1 2 0 } { 0 0 0 } { 0 }
|
||||
{ 1 1 1 } { -1 -1 -1 } { -1 -2 0 -3 } { -1 } }
|
||||
[ dup linear-combo "%-14u -> %s\n" printf ] each
|
||||
Loading…
Add table
Add a link
Reference in a new issue