Polynomial long division: Difference between revisions

m
(→‎{{header|zkl}}: the rest of the bug fix)
Line 1,946:
fcn polyString(terms){ // (a0,a1,a2...)-->"a0 + a1x + a2x^2 ..."
str:=[0..].zipWith('wrap(n,a){ if(a) "+ %sx^%s ".fmt(a,n) else "" },terms)
.sinkpump(String).walk()
.replace("x^0 "," ").replace(" 1x"," x").replace("x^1 ","x ")
.replace("+ -", "- ");
Anonymous user