Merge branch 'master' of git://factorcode.org/git/factor
commit
296a6d1d3c
|
@ -1279,9 +1279,9 @@ HELP: iota
|
||||||
{ $description "Creates an immutable virtual sequence containing the integers from 0 to " { $snippet "n-1" } "." }
|
{ $description "Creates an immutable virtual sequence containing the integers from 0 to " { $snippet "n-1" } "." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example
|
{ $example
|
||||||
"USING: math.parser sequences ;"
|
"USING: math sequences prettyprint ;"
|
||||||
"3 iota [ sq ] map ."
|
"3 iota [ sq ] map ."
|
||||||
"{ \"0\" \"1\" \"2\" }"
|
"{ 0 1 4 }"
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
|
@ -277,3 +277,7 @@ M: bogus-hashcode hashcode* 2drop 0 >bignum ;
|
||||||
{ 3 0 } [ [ 3drop ] 3each ] must-infer-as
|
{ 3 0 } [ [ 3drop ] 3each ] must-infer-as
|
||||||
|
|
||||||
[ V{ 0 3 } ] [ "A" { "A" "B" "C" "A" "D" } indices ] unit-test
|
[ 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
|
||||||
|
|
|
@ -101,11 +101,15 @@ M: integer nth-unsafe drop ;
|
||||||
|
|
||||||
INSTANCE: integer immutable-sequence
|
INSTANCE: integer immutable-sequence
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
! In the future, this will replace integer sequences
|
! 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
|
: iota ( n -- iota ) \ iota boa ; inline
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
M: iota length n>> ;
|
M: iota length n>> ;
|
||||||
M: iota nth-unsafe drop ;
|
M: iota nth-unsafe drop ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue