diff --git a/extra/benchmark/base64/base64.factor b/extra/benchmark/base64/base64.factor index 350a29f865..95202f35f9 100644 --- a/extra/benchmark/base64/base64.factor +++ b/extra/benchmark/base64/base64.factor @@ -4,7 +4,7 @@ USING: math sequences kernel base64 ; IN: benchmark.base64 : base64-benchmark ( -- ) - 65535 [ 255 bitand ] "" map-as + 65535 iota [ 255 bitand ] "" map-as 20 [ >base64 base64> ] times drop ; diff --git a/extra/benchmark/dawes/dawes.factor b/extra/benchmark/dawes/dawes.factor index 31c202b803..839bd89dc0 100644 --- a/extra/benchmark/dawes/dawes.factor +++ b/extra/benchmark/dawes/dawes.factor @@ -8,7 +8,7 @@ IN: benchmark.dawes : count-ones ( int-array -- n ) [ 1 = ] count ; inline : make-int-array ( -- int-array ) - 120000 [ 255 bitand ] int-array{ } map-as ; inline + 120000 iota [ 255 bitand ] int-array{ } map-as ; inline : dawes-benchmark ( -- ) 200 make-int-array '[ _ count-ones ] replicate drop ; diff --git a/extra/benchmark/dispatch2/dispatch2.factor b/extra/benchmark/dispatch2/dispatch2.factor index 87848cee9d..7db583d42a 100644 --- a/extra/benchmark/dispatch2/dispatch2.factor +++ b/extra/benchmark/dispatch2/dispatch2.factor @@ -5,8 +5,8 @@ IN: benchmark.dispatch2 : sequences ( -- seq ) [ - 1 , - 10 >bignum , + 1 iota , + 10 >bignum iota , { 1 2 3 } , "hello world" , SBUF" sbuf world" , @@ -14,7 +14,7 @@ IN: benchmark.dispatch2 double-array{ 1.0 2.0 3.0 } , "hello world" 4 tail-slice , 10 f , - 100 2 , + 100 iota 2 , "hello" , { { 1 2 } { 3 4 } } 0 , ?{ t f t } , diff --git a/extra/benchmark/dispatch4/dispatch4.factor b/extra/benchmark/dispatch4/dispatch4.factor index 2f989b7723..685c92a8cc 100644 --- a/extra/benchmark/dispatch4/dispatch4.factor +++ b/extra/benchmark/dispatch4/dispatch4.factor @@ -54,14 +54,14 @@ IN: benchmark.dispatch4 20000000 [ 20 [ foobar-1 drop - ] each + ] each-integer ] times ; : foobar-test-2 ( -- ) 20000000 [ 20 [ foobar-2 drop - ] each + ] each-integer ] times ; MAIN: foobar-test-1 diff --git a/extra/benchmark/e-decimals/e-decimals.factor b/extra/benchmark/e-decimals/e-decimals.factor index 7ef40aa65a..a7d875af3f 100644 --- a/extra/benchmark/e-decimals/e-decimals.factor +++ b/extra/benchmark/e-decimals/e-decimals.factor @@ -5,7 +5,7 @@ sequences ; IN: benchmark.e-decimals : D-factorial ( n -- D! ) - D: 1 [ 0 D: 1 D+ D* ] reduce ; inline + iota D: 1 [ 0 D: 1 D+ D* ] reduce ; inline :: calculate-e-decimals ( n -- e ) n [1,b] D: 1 diff --git a/extra/benchmark/empty-loop-2/empty-loop-2.factor b/extra/benchmark/empty-loop-2/empty-loop-2.factor index f09aee6ada..a6541856a5 100644 --- a/extra/benchmark/empty-loop-2/empty-loop-2.factor +++ b/extra/benchmark/empty-loop-2/empty-loop-2.factor @@ -2,7 +2,7 @@ USING: math math.private kernel sequences ; IN: benchmark.empty-loop-2 : empty-loop-2 ( n -- ) - [ drop ] each ; + iota [ drop ] each ; : empty-loop-main ( -- ) 50000000 empty-loop-2 ; diff --git a/extra/benchmark/fasta/fasta.factor b/extra/benchmark/fasta/fasta.factor index 5ba285dbb1..bd7ccafb9f 100644 --- a/extra/benchmark/fasta/fasta.factor +++ b/extra/benchmark/fasta/fasta.factor @@ -56,7 +56,7 @@ CONSTANT: homo-sapiens chars nth-unsafe ; inline : make-random-fasta ( seed len chars floats -- seed ) - [ rot drop select-random ] 2curry "" map-as print ; inline + [ iota ] 2dip [ [ drop ] 2dip select-random ] 2curry "" map-as print ; inline : write-description ( desc id -- ) ">" write write bl print ; inline @@ -72,7 +72,7 @@ CONSTANT: homo-sapiens :: make-repeat-fasta ( k len alu -- k' ) alu length :> kn - len [ k + kn mod alu nth-unsafe ] "" map-as print + len iota [ k + kn mod alu nth-unsafe ] "" map-as print k len + ; inline : write-repeat-fasta ( n alu desc id -- ) diff --git a/extra/benchmark/gc1/gc1.factor b/extra/benchmark/gc1/gc1.factor index 4909496d12..91989f204a 100644 --- a/extra/benchmark/gc1/gc1.factor +++ b/extra/benchmark/gc1/gc1.factor @@ -3,6 +3,6 @@ USING: math sequences kernel ; IN: benchmark.gc1 -: gc1 ( -- ) 600000 [ >bignum 1 + ] map drop ; +: gc1 ( -- ) 600000 iota [ >bignum 1 + ] map drop ; MAIN: gc1 diff --git a/extra/benchmark/knucleotide/knucleotide.factor b/extra/benchmark/knucleotide/knucleotide.factor index a28a676b90..70fa1bb061 100644 --- a/extra/benchmark/knucleotide/knucleotide.factor +++ b/extra/benchmark/knucleotide/knucleotide.factor @@ -25,7 +25,7 @@ IN: benchmark.knucleotide : small-groups ( x n -- b ) swap - [ length swap - 1 + ] 2keep + [ length swap - 1 + iota ] 2keep [ [ over + ] dip subseq ] 2curry map ; : handle-table ( inputs n -- ) diff --git a/extra/benchmark/partial-sums/partial-sums.factor b/extra/benchmark/partial-sums/partial-sums.factor index 023f5de5c2..aa6098a434 100644 --- a/extra/benchmark/partial-sums/partial-sums.factor +++ b/extra/benchmark/partial-sums/partial-sums.factor @@ -1,11 +1,11 @@ -! Copyright (C) 2008 Slava Pestov. +! 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 ; IN: benchmark.partial-sums ! Helper words -: summing-integers ( n quot -- y ) [ 0.0 ] 2dip '[ 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 diff --git a/extra/benchmark/random/random.factor b/extra/benchmark/random/random.factor index 4eab7c1669..761bf8478f 100644 --- a/extra/benchmark/random/random.factor +++ b/extra/benchmark/random/random.factor @@ -1,5 +1,5 @@ USING: io io.files io.files.temp io.encodings.ascii random -math.parser math ; +math.parser math sequences ; IN: benchmark.random : random-numbers-path ( -- path ) @@ -7,7 +7,7 @@ IN: benchmark.random : write-random-numbers ( n -- ) random-numbers-path ascii [ - [ 200 random 100 - number>string print ] times + [ 200 iota random 100 - number>string print ] times ] with-file-writer ; : random-main ( -- ) diff --git a/extra/benchmark/raytracer-simd/raytracer-simd.factor b/extra/benchmark/raytracer-simd/raytracer-simd.factor index 45407e5ad2..dcdc911cbf 100644 --- a/extra/benchmark/raytracer-simd/raytracer-simd.factor +++ b/extra/benchmark/raytracer-simd/raytracer-simd.factor @@ -149,7 +149,7 @@ DEFER: create ( level c r -- scene ) [ oversampling /f ] bi@ 0.0 0.0 double-4-boa ; : ss-grid ( -- ss-grid ) - oversampling [ oversampling [ ss-point ] with map ] map ; + oversampling iota [ oversampling iota [ ss-point ] with map ] map ; : ray-grid ( point ss-grid -- ray-grid ) [ @@ -161,8 +161,8 @@ DEFER: create ( level c r -- scene ) [ [ swap cast-ray + ] with each ] with each ; : pixel-grid ( -- grid ) - size reverse [ - size [ + size iota reverse [ + size iota [ [ size 0.5 * - ] bi@ swap size 0.0 double-4-boa ] with map diff --git a/extra/benchmark/raytracer/raytracer.factor b/extra/benchmark/raytracer/raytracer.factor index 2413e7fd1e..868743b46a 100644 --- a/extra/benchmark/raytracer/raytracer.factor +++ b/extra/benchmark/raytracer/raytracer.factor @@ -148,7 +148,7 @@ DEFER: create ( level c r -- scene ) [ oversampling /f ] bi@ 0.0 double-array{ } 3sequence ; : ss-grid ( -- ss-grid ) - oversampling [ oversampling [ ss-point ] with map ] map ; + oversampling iota [ oversampling iota [ ss-point ] with map ] map ; : ray-grid ( point ss-grid -- ray-grid ) [ @@ -160,8 +160,8 @@ DEFER: create ( level c r -- scene ) [ [ swap cast-ray + ] with each ] with each ; : pixel-grid ( -- grid ) - size reverse [ - size [ + size iota reverse [ + size iota [ [ size 0.5 * - ] bi@ swap size double-array{ } 3sequence ] with map diff --git a/extra/benchmark/ring/ring.factor b/extra/benchmark/ring/ring.factor index ae918b7ebc..08e8edbeff 100644 --- a/extra/benchmark/ring/ring.factor +++ b/extra/benchmark/ring/ring.factor @@ -13,7 +13,7 @@ SYMBOL: done ] times ; : send-messages ( messages target -- ) - dupd [ send ] curry each [ receive drop ] times ; + [ dup iota ] dip [ send ] curry each [ receive drop ] times ; : destroy-ring ( target -- ) done swap send [ done eq? ] receive-if drop ; diff --git a/extra/benchmark/spectral-norm/spectral-norm.factor b/extra/benchmark/spectral-norm/spectral-norm.factor index 68efffe083..386ffb0ae1 100644 --- a/extra/benchmark/spectral-norm/spectral-norm.factor +++ b/extra/benchmark/spectral-norm/spectral-norm.factor @@ -7,8 +7,8 @@ SPECIALIZED-ARRAY: double IN: benchmark.spectral-norm :: inner-loop ( u n quot -- seq ) - n [| i | - n 0.0 [| j | + n iota [| i | + n iota 0.0 [| j | u i j quot call + ] reduce ] double-array{ } map-as ; inline diff --git a/extra/benchmark/tuple-arrays/tuple-arrays.factor b/extra/benchmark/tuple-arrays/tuple-arrays.factor index 38ce0087a2..701db77135 100644 --- a/extra/benchmark/tuple-arrays/tuple-arrays.factor +++ b/extra/benchmark/tuple-arrays/tuple-arrays.factor @@ -9,7 +9,7 @@ TUPLE: point { x float } { y float } { z float } ; TUPLE-ARRAY: point : tuple-array-benchmark ( -- ) - 100 [ + 100 iota [ drop 5000 [ [ 1 + ] change-x [ 1 - ] change-y diff --git a/extra/benchmark/ui-panes/ui-panes.factor b/extra/benchmark/ui-panes/ui-panes.factor index 6fdbdaecf6..9d16f75e15 100644 --- a/extra/benchmark/ui-panes/ui-panes.factor +++ b/extra/benchmark/ui-panes/ui-panes.factor @@ -2,6 +2,6 @@ USING: ui.gadgets.panes prettyprint io sequences ; IN: benchmark.ui-panes : ui-pane-benchmark ( -- ) - [ 10000 [ . ] each ] with-output-stream* ; + [ 10000 iota [ . ] each ] with-output-stream* ; MAIN: ui-pane-benchmark diff --git a/extra/benchmark/yuv-to-rgb/yuv-to-rgb.factor b/extra/benchmark/yuv-to-rgb/yuv-to-rgb.factor index 024887991e..b182b4f832 100644 --- a/extra/benchmark/yuv-to-rgb/yuv-to-rgb.factor +++ b/extra/benchmark/yuv-to-rgb/yuv-to-rgb.factor @@ -27,9 +27,9 @@ STRUCT: yuv_buffer h >>uv_height w >>y_stride w >>uv_stride - w h * [ dup * ] B{ } map-as malloc-byte-array &free >>y - w h * 2/ [ dup dup * * ] B{ } map-as malloc-byte-array &free >>u - w h * 2/ [ dup * dup * ] B{ } map-as malloc-byte-array &free >>v ; + w h * iota [ dup * ] B{ } map-as malloc-byte-array &free >>y + w h * 2/ iota [ dup dup * * ] B{ } map-as malloc-byte-array &free >>u + w h * 2/ iota [ dup * dup * ] B{ } map-as malloc-byte-array &free >>v ; : clamp ( n -- n ) 255 min 0 max ; inline @@ -76,12 +76,12 @@ STRUCT: yuv_buffer : yuv>rgb-row ( index rgb yuv y -- index ) over stride - pick y_width>> + pick y_width>> iota [ yuv>rgb-pixel ] with with with with each ; inline : yuv>rgb ( rgb yuv -- ) [ 0 ] 2dip - dup y_height>> + dup y_height>> iota [ yuv>rgb-row ] with with each drop ;