Vocabulary
assocs

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


Outputs
newassoca new 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 input.

Examples
: discount ( prices n -- newprices ) [ - ] curry assoc-map ; H{ { "bananas" 5 } { "apples" 42 } { "pears" 17 } } 2 discount .
H{ { "bananas" 3 } { "apples" 40 } { "pears" 15 } }


See also
assoc-map-as

Definition


: assoc-map
( ... assoc quot: ( ... key value -- ... newkey newvalue ) -- ... newassoc )
over assoc-map-as ; inline