chickadee » alist-lib » alist-fold

alist-fold alist f initprocedure

Fold an alist; whose f takes key, value, accumulatum.

alist
The alist to fold
f
The function to apply to key, value, accumulatum
init
The seed of the fold
(define (alist-fold alist f init)
  (fold (lambda (association accumulatum)
          (match association ((key . value) (f key value accumulatum))))
        init
        alist))