math.polynomials: update pdiff for no-integers-as-sequences (reported by rswarbrick)

db4
Joe Groff 2010-07-04 09:23:43 -07:00
parent a55c8ee671
commit c6fd20b107
2 changed files with 3 additions and 1 deletions

View File

@ -31,3 +31,5 @@ IN: math.polynomials.tests
[ t ] [ { 1 1 1 } { 1 1 1 } p= ] unit-test
[ { 0 0 } { 1 1 } ] [ { 1 1 1 1 } { 1 1 } pgcd ] unit-test
[ { 10 200 3000 } ] [ { 1 10 100 1000 } pdiff ] unit-test

View File

@ -88,7 +88,7 @@ PRIVATE>
[ V{ 0 } clone V{ 1 } clone ] 2dip swap (pgcd) [ >array ] bi@ ;
: pdiff ( p -- p' )
dup length v* { 0 } ?head drop ;
dup length iota v* unclip drop ;
: polyval ( x p -- p[x] )
[ length swap powers ] [ nip ] 2bi v. ;