Handbook
Glossary
assoc-clone-like ( assoc exemplar -- newassoc )
Factor handbook
»
The language
»
Collections
»
Associative mapping operations
»
Associative mapping conversions
Next:
assoc-union-all ( seq -- union )
Vocabulary
assocs
Inputs
assoc
an
assoc
exemplar
an
assoc
Outputs
newassoc
an
assoc
Word description
Outputs a newly-allocated assoc with the same elements as
assoc
.
Examples
USING: prettyprint assocs hashtables ; H{ { 1 2 } { 3 4 } } { } assoc-clone-like .
{ { 1 2 } { 3 4 } }
Definition
IN:
assocs
GENERIC:
assoc-clone-like
( assoc exemplar -- newassoc )
Methods
USING:
assocs
kernel
;
M:
assoc
assoc-clone-like
over
[
assoc-size
]
[
new-assoc
]
[
assoc-union!
]
tri*
;
inline
USING:
assocs
kernel
sequences
;
M:
sequence
assoc-clone-like
[
>alist
]
dip
clone-like
;
inline
USING:
assocs
generic
kernel
sequences
trees
trees.private
trees.splay
;
M:
splay
assoc-clone-like
[
dup
tree?
[
>bfs-alist
reverse
]
when
]
dip
M\
splay
assoc-clone-like
(call-next-method)
;
USING:
accessors
assocs
kernel
xml.data
;
M:
tag
assoc-clone-like
[
attrs>>
]
call
\
assoc-clone-like
execute
;
USING:
assocs
generic
kernel
trees
trees.private
;
M:
tree
assoc-clone-like
[
dup
tree?
[
>bfs-alist
]
when
]
dip
M\
tree
assoc-clone-like
(call-next-method)
;