Handbook
Glossary
ppush ( val seq -- seq' )
Persistent sequence protocol
Prev:
new-nth ( val i seq -- seq' )
Next:
ppop ( seq -- seq' )
Vocabulary
persistent
.
sequences
Inputs
val
an
object
seq
a
sequence
Outputs
seq'
a
sequence
Generic word contract
Persistent analogue of
push
. Outputs a new sequence with all elements of
seq
together with
val
added at the end.
Definition
IN:
persistent.sequences
GENERIC:
ppush
( val seq -- seq' )
Methods
USING:
accessors
kernel
math
persistent.sequences
persistent.vectors
persistent.vectors.private
;
M:
persistent-vector
ppush
clone
dup
tail>>
full?
[
ppush-new-tail
]
[
ppush-tail
]
if
[
1
+
]
change-count
;
USING:
kernel
persistent.sequences
sequences
;
M:
sequence
ppush
swap
suffix
;
USING:
kernel
math
persistent.sequences
sequences
vlists
vlists.private
;
M:
vlist
ppush
>vlist<
2dup
length
=
[
unshare
]
unless
[
[
1
+
swap
]
dip
push
]
keep
vlist
boa
;