Handbook
Glossary
head-slice ( seq n -- slice )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Subsequences and slices
Prev:
<slice> ( from to seq -- slice )
Next:
tail-slice ( seq n -- slice )
Vocabulary
sequences
Inputs
seq
a
sequence
n
a non-negative integer
Outputs
slice
a slice
Word description
Outputs a virtual sequence sharing storage with the first
n
elements of the input sequence.
Errors
Throws an error if the index is out of bounds.
See also
head
,
head*
,
head-slice*
Definition
USING:
sequences.private
;
IN:
sequences
:
head-slice
( seq n -- slice )
head-to-index
<slice>
;
inline