Handbook
Glossary
pad-head ( seq n elt -- padded )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Appending sequences
Prev:
join ( seq glue -- newseq )
Next:
pad-tail ( seq n elt -- padded )
Vocabulary
sequences
Inputs
seq
a
sequence
n
a non-negative integer
elt
an
object
Outputs
padded
a new sequence
Word description
Outputs a new sequence consisting of
seq
padded on the left with enough repetitions of
elt
to have the result be of length
n
.
Examples
USING: io sequences ; { "ab" "quux" } [ 5 CHAR: - pad-head print ] each
---ab -quux
Definition
USING:
kernel
sequences.private
;
IN:
sequences
:
pad-head
( seq n elt -- padded )
[
swap
dup
append-as
]
padding
;