- (alist-set! alist key value) → unspecifiedsyntax
Destructively set a key-value association.
- alist
- The alist in which to set
- key
- The key to set
- value
- The value to associate with the key
(define-syntax alist-set! (lambda (expression rename compare) (match expression ((_ variable key value) (let ((%if (rename 'if)) (%null? (rename 'null?)) (%set! (rename 'set!)) (%list (rename 'list)) (%cons (rename 'cons)) (%alist-prepend! (rename 'alist-prepend!))) `(,%if (,%null? ,variable) (,%set! ,variable (,%list (,%cons ,key ,value))) (,%alist-prepend! ,variable ,key ,value)))))))