mes: assq, assoc-ref: Handle non-A-LISTs.

* src/mes.c (assq): Return #f if A-LIST is not a list.
* module/mes/scm.mes (assoc): Likewise.
This commit is contained in:
Jan Nieuwenhuizen 2018-04-29 16:17:07 +02:00
parent 8911af4aa8
commit c20ef52f6f
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 3 additions and 1 deletions

View file

@ -109,7 +109,7 @@
(define assv-ref assq-ref)
(define (assoc key alist)
(if (null? alist) #f
(if (not (pair? alist)) #f
(if (equal? key (caar alist)) (car alist)
(assoc key (cdr alist)))))

View file

@ -713,6 +713,8 @@ call (SCM fn, SCM x)
SCM
assq (SCM x, SCM a)
{
if (TYPE (a) != TPAIR)
return cell_f;
switch (TYPE (x))
{
case TCHAR: