Handbook
Glossary
indices ( obj seq -- indices )
Vocabulary
sequences
Inputs
obj
an
object
seq
a
sequence
Outputs
indices
a
sequence
Word description
Compares the input object to every element in the sequence and returns a vector containing the index of every position where the element was found.
Examples
USING: sequences prettyprint ; 2 { 2 4 2 6 2 8 2 10 } indices .
V{ 0 2 4 6 }
Definition
USING:
kernel
;
IN:
sequences
:
indices
( obj seq -- indices )
swap
[
=
]
curry
[
swap
]
prepose
V{
}
clone
[
[
push
]
curry
[
[
drop
]
if
]
curry
compose
each-index
]
keep
;