with-associations
Das Macro with-associations erwartet drei Argumente. Nur das erste Argument wird nicht ausgewertet. Das erste Argument ist eine Liste von Schlüsseln in einer Assoziationsliste. Das zweite Argument ist eine Assoziationsliste. Das dritte Argument ist ein Ausdruck, der innerhalb einer Umgebung ausgewertet wird, in der die Schlüssel ihrem Wert in der Assoziationsliste zugeordnet sind:
> (with-associations (one two) (quote ((one 1) (two 2))) (list one two))
(1 2)
Das Macro basiert im Wesentlichen auf let, second-or-nil und assoc:
(setq with-associations
(mlambda args
(let
((alist (second args)))
(list
let
(map-with
(lambda (association)
(list
association
(list
second-or-nil
(list
assoc
(list quote association)
alist))))
(first args))
(third args)))))
> (with-associations (one two) (quote ((one 1) (two 2))) (list one two))
(1 2)
Das Macro basiert im Wesentlichen auf let, second-or-nil und assoc:
(setq with-associations
(mlambda args
(let
((alist (second args)))
(list
let
(map-with
(lambda (association)
(list
association
(list
second-or-nil
(list
assoc
(list quote association)
alist))))
(first args))
(third args)))))