Alist functions provide utilities for treating a list of key-value pairs as an associative database. These functions take an equality predicate, pred, as an argument. This predicate should be repeatable, symmetric, and transitive.
Alist functions can be used with a secondary index method such as hash tables for improved performance.
Returns an association function (like
assoc) corresponding to pred. The returned function
returns a key-value pair whose key is
pred-equal to its first
#f if no key in the alist is pred-equal to the
Returns a procedure of 2 arguments, alist and key, which
returns the value associated with key in alist or
key does not appear in alist.
Returns a procedure of 3 arguments, alist, key, and value, which returns an alist with key and value associated. Any previous value associated with key will be lost. This returned procedure may or may not have side effects on its alist argument. An example of correct usage is:
(define put (alist-associator string-ci=?)) (define alist '()) (set! alist (put alist "Foo" 9))
Returns a procedure of 2 arguments, alist and key, which returns an alist with an association whose key is key removed. This returned procedure may or may not have side effects on its alist argument. An example of correct usage is:
(define rem (alist-remover string-ci=?)) (set! alist (rem alist "foo"))
Returns a new association list formed by mapping proc over the keys and values of alist. proc must be a function of 2 arguments which returns the new value part.
Applies proc to each pair of keys and values of alist. proc must be a function of 2 arguments. The returned value is unspecified.