From 048a208ec05f006ddcbb3590ecf43adbee9f9ccc Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Sun, 19 Jul 1998 04:28:51 +0000 Subject: [PATCH] * hcons.scm (hashq-cons-assoc): Don't assume the empty list is false. Return false when we cannot find a matching entry in the list. (Thanks to Andrew Archibald.) --- ice-9/hcons.scm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ice-9/hcons.scm b/ice-9/hcons.scm index 6c0e0ba50..ebbf58651 100644 --- a/ice-9/hcons.scm +++ b/ice-9/hcons.scm @@ -36,13 +36,14 @@ n)) (define-public (hashq-cons-assoc key l) - (and l (or (and (pair? l) - (pair? (car l)) - (pair? (caar l)) - (eq? (car key) (caaar l)) - (eq? (cdr key) (cdaar l)) - (car l)) - (hashq-cons-assoc key (cdr l))))) + (and (not (null? l)) + (or (and (pair? l) ; If not a pair, use its cdr? + (pair? (car l)) + (pair? (caar l)) + (eq? (car key) (caaar l)) + (eq? (cdr key) (cdaar l)) + (car l)) + (hashq-cons-assoc key (cdr l))))) (define-public (hashq-cons-get-handle table key) (hashx-get-handle hashq-cons-hash hashq-cons-assoc table key #f))