chickadee » alist-lib » alist-ref/default

alist-ref/default alist key defaultprocedure
alist-ref/default alist key default =procedure

Return a value associated with its key or default.

The alist to search in
The key whose value to return
The default to return when association doesn't exist
The equality predicate to apply to keys
(define alist-ref/default
    ((alist key default) (alist-ref alist key (lambda () default)))
    ((alist key default =) (alist-ref alist key (lambda () default) =))))