Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
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
assoc
an
assoc
quot
a
quotation
true-assoc
an
assoc
false-assoc
an
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