(ice-9 hcons) broken

Andrew Archibald (aarchiba@undergrad.math.uwaterloo.ca)
Tue, 28 Apr 1998 23:46:48 -0400 (EDT)

Hi,

The hash conser module is broken:
(use-modules (ice-9 hcons))
(define fox (hashq-conser 7))
(display (fox 'foo 'bar))
=> error

It seems to be a holdover from (eq? #f '()) days.

The fix is easy enough... but I don't trust it.

The hash conser is used in the lang package; but this hasn't been
functional since (eq? #f '()) either. In fact, it uses that fact
throughout the code of the parser. If anyone's keen to try fixing it,
please do... I have the lexer and rx "working", modulo a highly
dubious tweak to (ice-9 lineio).

Andrew
aarchiba@undergrad.math.uwaterloo.ca

*** ice-9/hcons.scm Tue Apr 28 19:06:22 1998
--- /roo/usr/guile-core-19980424/ice-9/hcons.scm Tue Jun 24
12:26:22 1997***************
*** 36,50 ****
n))

(define-public (hashq-cons-assoc key l)
! (if (eq? l '()) '() ; (not (eq? #f '()))
! (and 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))
--- 36,48 ----
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)))))

(define-public (hashq-cons-get-handle table key)
(hashx-get-handle hashq-cons-hash hashq-cons-assoc table key #f))