]> gitweb.factorcode.org Git - factor.git/commitdiff
project-euler.150: bit faster with inline.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sat, 29 Sep 2012 02:21:23 +0000 (19:21 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 29 Sep 2012 02:21:23 +0000 (19:21 -0700)
extra/project-euler/150/150.factor

index 2581e907b5c934a290949fc6c2d292a25136ace1..169e7005be155b28b65c54642c9098976eb6a81f 100644 (file)
@@ -48,7 +48,7 @@ IN: project-euler.150
     615949 * 797807 + 20 2^ rem dup 19 2^ - ; inline
 
 : sums-triangle ( -- seq )
-    0 1000 [1,b] [ [ next ] replicate partial-sums ] map nip ;
+    0 1000 [1,b] [ [ next ] replicate partial-sums ] map nip ; inline
 
 :: (euler150) ( m -- n )
     sums-triangle :> table
@@ -57,12 +57,10 @@ IN: project-euler.150
             m x - iota [| z |
                 x z + table nth-unsafe
                 [ y z + 1 + swap nth-unsafe ]
-                [ y        swap nth-unsafe ] bi -
+                [ y         swap nth-unsafe ] bi -
             ] partial-sum-infimum
         ] map-infimum
-    ] map-infimum ;
-
-HINTS: (euler150) fixnum ;
+    ] map-infimum ; inline
 
 PRIVATE>