Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
unzip ( assoc -- keys values )
Factor documentation
>
Factor handbook
>
The language
>
Collections
>
Associative mapping operations
>
Associative mapping conversions
Prev:
zip ( keys values -- alist )
Vocabulary
assocs
Inputs and outputs
assoc
an
assoc
keys
a
sequence
values
a
sequence
Word description
Outputs an array of keys and an array of values of the input
assoc
.
Examples
USING: prettyprint assocs kernel ; { { 1 4 } { 2 5 } { 3 6 } } unzip [ . ] bi@
{ 1 2 3 } { 4 5 6 }
See also
zip
Definition
USING:
kernel
sequences
;
IN:
assocs
:
unzip
( assoc -- keys values )
dup
assoc-empty?
[
drop
{
}
{
}
]
[
>alist
flip
first2
]
if
;