mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 20:30:28 +02:00
* 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.)
This commit is contained in:
parent
3910272e9f
commit
048a208ec0
1 changed files with 8 additions and 7 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue