Handbook
Glossary
push-back* ( obj deque -- node )
Factor handbook
»
The language
»
Collections
»
Deques
Prev:
push-front* ( obj deque -- node )
Next:
pop-front* ( deque -- )
Vocabulary
deques
Inputs
obj
an
object
deque
a
deque
Outputs
node
a node
Generic word contract
Push the object onto the back of the deque and return the newly created node.
Notes
This operation is O(1).
Definition
IN:
deques
GENERIC:
push-back*
( obj deque -- node )
Methods
USING:
accessors
deques
dlists
kernel
;
M:
dlist
push-back*
[
[
f
<dlist-node>
dup
dup
]
[
set-next-when
]
bi
]
change-back
set-front-to-back
;
USING:
accessors
assocs
deques
kernel
search-deques
;
M:
search-deque
push-back*
2dup
assoc>>
at*
[
2nip
]
[
drop
[
deque>>
push-back*
dup
]
[
assoc>>
set-at
]
2bi
]
if
;
USING:
accessors
deques
kernel
unrolled-lists
unrolled-lists.private
;
M:
unrolled-list
push-back*
dup
[
back>>
]
[
back-pos>>
unroll-factor
eq?
not
]
bi
[
drop
]
[
and
]
2bi
[
push-back/existing
]
[
drop
push-back/new
]
if
f
;