assoc-partition ( ... assoc quot: ( ... key value -- ... ? ) -- ... true-assoc false-assoc )
Factor documentation > Factor handbook > The language > Collections > Associative mapping operations > Associative mapping combinators
Prev:assoc-filter-as ( ... assoc quot: ( ... key value -- ... ? ) exemplar -- ... subassoc )
Next:assoc-any? ( ... assoc quot: ( ... key value -- ... ? ) -- ... ? )


Vocabulary
assocs

Inputs and outputs
assocan assoc
quota quotation
true-assocan assoc
false-assocan assoc


Word description
Calls a predicate quotation on each key of the input assoc. If the test yields true, the key/value pair is added to true-assoc; if false, it's added to false-assoc.

Definition
USING: assocs.private kernel sequences ;

IN: assocs

: assoc-partition
( ... assoc quot: ( ... key value -- ... ? ) -- ... true-assoc false-assoc )
[ (assoc-each) partition ] [ drop ] 2bi
[ assoc-like ] curry bi@ ; inline