mes: assq-ref, assoc-ref: Support alist == #f.

* mes/module/mes/scm.mes (assq-ref): Support alist == #f.
(assoc-ref): Likewise.
This commit is contained in:
Jan Nieuwenhuizen 2018-12-15 12:56:15 +01:00
parent 750fef8dfb
commit e90aed9d1b
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -101,17 +101,19 @@
alist))))
(define (assq-ref alist key)
(let ((entry (assq key alist)))
(if entry (cdr entry)
#f)))
(and alist
(let ((entry (assq key alist)))
(if entry (cdr entry)
#f))))
(define assv assq)
(define assv-ref assq-ref)
(define (assoc-ref alist key)
(let ((entry (assoc key alist)))
(if entry (cdr entry)
#f)))
(and (pair? alist)
(let ((entry (assoc key alist)))
(if entry (cdr entry)
#f))))
(define (assoc-set! alist key value)
(let ((entry (assoc key alist)))