assoc-map-as ( ... assoc quot: ( ... key value -- ... newkey newvalue ) exemplar -- ... newassoc )
Factor handbook » The language » Collections » Associative mapping operations » Associative mapping combinators

Prev:assoc-map ( ... assoc quot: ( ... key value -- ... newkey newvalue ) -- ... newassoc )
Next:assoc-filter ( ... assoc quot: ( ... key value -- ... ? ) -- ... subassoc )


Vocabulary
assocs

Inputs
assocan assoc
quota quotation with stack effect ( ... key value -- ... newkey newvalue )
exemplaran assoc


Outputs
newassocan assoc


Word description
Applies the quotation to each entry in the input assoc and collects the results in a new assoc of the same type as the exemplar.

Examples
USING: prettyprint assocs hashtables math ; H{ { 1 2 } { 3 4 } } [ sq ] { } assoc-map-as .
{ { 1 4 } { 3 16 } }


See also
assoc-map

Definition


: assoc-map-as
( ... assoc quot: ( ... key value -- ... newkey newvalue ) exemplar -- ... newassoc )
[ [ 2array ] compose { } assoc>map ] dip assoc-like ; inline