assoc-partition ( ... assoc quot: ( ... key value -- ... ? ) -- ... true-assoc false-assoc )
Factor handbook » The language » Collections » Associative mapping operations » Associative mapping combinators

Prev:assoc-reject-as ( ... assoc quot: ( ... key value -- ... ? ) exemplar -- ... subassoc )
Next:assoc-any? ( ... assoc quot: ( ... key value -- ... ? ) -- ... ? )


Vocabulary
assocs

Inputs
assocan assoc
quota quotation


Outputs
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


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