]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/benchmark/partial-sums/partial-sums.factor
factor: trim using lists
[factor.git] / extra / benchmark / partial-sums / partial-sums.factor
index aa6098a43458f4a82d61a51ff80977fd61d0a94d..8fe7e04c66b9eceac745645b554c785ec9cee228 100644 (file)
@@ -1,11 +1,11 @@
 ! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: math math.functions kernel io io.styles prettyprint
-combinators hints fry namespaces sequences ;
+USING: make math math.functions kernel prettyprint
+combinators hints sequences ;
 IN: benchmark.partial-sums
 
 ! Helper words
-: summing-integers ( n quot -- y ) [ 0.0 ] [ iota ] [ ] tri* '[ 1 + @ + ] each ; inline
+: summing-integers ( n quot -- y ) [ 0.0 ] [ <iota> ] [ ] tri* '[ 1 + @ + ] each ; inline
 : summing-floats ( n quot -- y ) '[ >float @ ] summing-integers ; inline
 : cube ( x -- y ) dup dup * * ; inline
 : -1^ ( n -- -1/1 ) 2 mod 2 * 1 - ; inline
@@ -24,21 +24,21 @@ IN: benchmark.partial-sums
 : partial-sums ( n -- results )
     [
         {
-            [ 2/3^k                 \ 2/3^k                set ]
-            [ k^-0.5                \ k^-0.5               set ]
-            [ 1/k(k+1)              \ 1/k(k+1)             set ]
-            [ flint-hills           \ flint-hills          set ]
-            [ cookson-hills         \ cookson-hills        set ]
-            [ harmonic              \ harmonic             set ]
-            [ riemann-zeta          \ riemann-zeta         set ]
-            [ alternating-harmonic  \ alternating-harmonic set ]
-            [ gregory               \ gregory              set ]
+            [ 2/3^k                 \ 2/3^k                ,, ]
+            [ k^-0.5                \ k^-0.5               ,, ]
+            [ 1/k(k+1)              \ 1/k(k+1)             ,, ]
+            [ flint-hills           \ flint-hills          ,, ]
+            [ cookson-hills         \ cookson-hills        ,, ]
+            [ harmonic              \ harmonic             ,, ]
+            [ riemann-zeta          \ riemann-zeta         ,, ]
+            [ alternating-harmonic  \ alternating-harmonic ,, ]
+            [ gregory               \ gregory              ,, ]
         } cleave
-    ] { } make-assoc ;
+    ] { } make ;
 
 HINTS: partial-sums fixnum ;
 
-: partial-sums-main ( -- )
+: partial-sums-benchmark ( -- )
     2500000 partial-sums simple-table. ;
 
-MAIN: partial-sums-main
+MAIN: partial-sums-benchmark