Handbook
Glossary
insert-nth! ( elt n seq -- )
Vocabulary
sequences
.
extras
Inputs
elt
an
object
n
an
integer
seq
a
sequence
Outputs
None
Word description
A variant of
insert-nth
that modifies
seq
in place.
Definition
USING:
growable
kernel
math
sequences
sequences.private
;
IN:
sequences.extras
:
insert-nth!
( elt n seq -- )
dupd
[
length
[
swap
-
1
+
]
keep
]
keep
ensure
[
[
[
swap
-
dup
1
-
]
curry
]
dip
[
move-unsafe
]
curry
compose
each-integer
]
keep
set-nth-unsafe
;