diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor index 957b33198e..651c8e8a14 100644 --- a/core/sequences/sequences-docs.factor +++ b/core/sequences/sequences-docs.factor @@ -1279,9 +1279,9 @@ HELP: iota { $description "Creates an immutable virtual sequence containing the integers from 0 to " { $snippet "n-1" } "." } { $examples { $example - "USING: math.parser sequences ;" + "USING: math sequences prettyprint ;" "3 iota [ sq ] map ." - "{ \"0\" \"1\" \"2\" }" + "{ 0 1 4 }" } } ; diff --git a/core/sequences/sequences-tests.factor b/core/sequences/sequences-tests.factor index 80352faf72..9adc6bc602 100644 --- a/core/sequences/sequences-tests.factor +++ b/core/sequences/sequences-tests.factor @@ -276,4 +276,8 @@ M: bogus-hashcode hashcode* 2drop 0 >bignum ; { 3 0 } [ [ 3drop ] 3each ] must-infer-as -[ V{ 0 3 } ] [ "A" { "A" "B" "C" "A" "D" } indices ] unit-test \ No newline at end of file +[ V{ 0 3 } ] [ "A" { "A" "B" "C" "A" "D" } indices ] unit-test + +[ "asdf" iota ] must-fail +[ T{ iota { n 10 } } ] [ 10 iota ] unit-test +[ 0 ] [ 10 iota first ] unit-test diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor index 2a499845bd..5a92dcaf2d 100644 --- a/core/sequences/sequences.factor +++ b/core/sequences/sequences.factor @@ -101,11 +101,15 @@ M: integer nth-unsafe drop ; INSTANCE: integer immutable-sequence +PRIVATE> + ! In the future, this will replace integer sequences -TUPLE: iota { n read-only } ; +TUPLE: iota { n integer read-only } ; : iota ( n -- iota ) \ iota boa ; inline +> ; M: iota nth-unsafe drop ;