chickadee » integer-map » fxmapping-fold

fxmapping-fold kons knil fxmapprocedure
fxmapping-fold-right kons knil fxmapprocedure

The kons argument of fxmapping-fold and fxmapping-fold-right is a procedure of type fixnum * * → *. knil is an object of any type which can be passed to kons as its third argument.

Folds kons over fxmap, using knil as the base value. At each step, kons is applied to the key of an association, its associated value, and to the result of the last application. fxmapping-fold folds in ascending numerical order of keys; fxmapping-fold-right folds in descending order.

Examples:

(fxmapping-fold-right (lambda (_ v vs) (cons v vs))
                      '()
                      (fxmapping 0 "worf" 1 "data" 2 "crusher"))
 ⇒ ("worf" "data" "crusher")

(fxmapping-fold (lambda (k _ ks) (cons k ks))
                '()
                (fxmapping 0 "worf" 1 "data" 2 "crusher"))
 ⇒ (2 1 0)