Version: 5.2
9 Dictionaries
This module provides tools for manipulating dictionary values.
Reports whether d is empty (has no keys).
Computes the union of d0 with each dictionary d by functional
update, adding each element of each d to d0 in turn. For each
key k and value v, if a mapping from k to some value
v0 already exists, it is replaced with a mapping from k to
(combine/key k v0 v).
Examples: |
> (dict-union '([1 . one]) '([2 . two]) '([3 . three])) | '((1 . one) (2 . two) (3 . three)) | > (dict-union '([1 one uno] [2 two dos]) | '([1 ein une] [2 zwei deux]) | #:combine/key (lambda (k v1 v2) (append v1 v2))) |
| '((1 one uno ein une) (2 two dos zwei deux)) |
|
Computes the union of d0 with each dictionary d by mutable
update, adding each element of each d to d0 in turn. For each
key k and value v, if a mapping from k to some value
v0 already exists, it is replaced with a mapping from k to
(combine/key k v0 v).
Examples: |
| > d | '#hash() | > (dict-union! d '([1 one uno] [2 two dos])) | > d | '#hash((1 . (one uno)) (2 . (two dos))) | | > d | '#hash((1 . (one uno ein une)) (2 . (two dos zwei deux))) |
|