]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/math/polynomials/polynomials.factor
factor: trim using lists
[factor.git] / basis / math / polynomials / polynomials.factor
index b2ce6945f2e71aa14aad830885587ae2d41460e5..225ea075377bca8eff23beb858041c5966ee05de 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays combinators fry kernel macros make math math.bits
-math.order math.vectors sequences splitting vectors ;
+USING: arrays combinators kernel make math math.bits
+math.vectors sequences vectors ;
 IN: math.polynomials
 
 <PRIVATE
@@ -33,10 +33,10 @@ ALIAS: n*p n*v
 
 : p* ( p q -- r )
     2unempty pextend-conv
-    [ drop length [ iota ] keep ]
+    [ drop length [ <iota> ] keep ]
     [ nip <reversed> ]
     [ drop ] 2tri
-    '[ _ _ <slice> _ v* sum ] map reverse! ;
+    '[ _ _ <slice> _ vdot ] map reverse! ;
 
 : p-sq ( p -- p^2 ) dup p* ; inline
 
@@ -86,7 +86,7 @@ PRIVATE>
     [ V{ 0 } clone V{ 1 } clone ] 2dip swap (pgcd) [ >array ] bi@ ;
 
 : pdiff ( p -- p' )
-    dup length iota v* rest ;
+    dup length <iota> v* rest ;
 
 : polyval ( x p -- p[x] )
     ! Horner scheme