bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hashx -set! and -ref


From: Gregory Marton
Subject: Re: hashx -set! and -ref
Date: Mon, 14 Jan 2008 17:43:25 -0500 (EST)

Done. Thanks -- the test patch is updated since my last email here, because somehow when writing those tests (but not the resize ones!) I failed to realize about the second argument being assoc. Sorry 'bout that.

I think this gets me somewhat back on the road. I just need to make a really big hash table.

Thanks,
Grem

Gregory Marton <address@hidden> writes:

I may be misunderstanding something, but I thought this should yield 'bar:

guile> (let ((ht (make-hash-table)))
         (hashx-set! (lambda (k s) 1) equal? ht 'foo 'bar)
         (hashx-ref (lambda (k s) 1) equal? ht 'foo))

#f

The second arg to hashx-set! and hashx-ref is supposed to be like
assoc/assq/assv, not equal?/eqv?/eq?.  So...

guile> (let ((ht (make-hash-table)))
        (hashx-set! (lambda (k s) 1) assoc ht 'foo 'bar)
        (hashx-ref (lambda (k s) 1) assoc ht 'foo))
bar


I thought perhaps the problem was with the equality test somehow, but
then even worse:
guile> (let ((ht (make-hash-table)))
         (hashx-set! (lambda (k s) 1) (lambda (a b) #t) ht 'foo 'bar)
         (hashx-ref (lambda (k s) 1) (lambda (a b) #t) ht 'foo))

Bus error

That definitely shouldn't happen, though.  Would you mind raising this
as a bug at Guile's Savannah project, for ease of tracking, and attach
the test patch that reproduces it (for which many thanks!).

Regards,
       Neil



--
------ __@   Gregory A. Marton                http://csail.mit.edu/~gremio/
--- _`\<,_                                                                .
-- (*)/ (*)             Never go to bed mad.  Stay up and fight!
~~~~~~~~~~~~~~~~-~~~~~~~~_~~~_~~~~~v~~~~^^^^~~~~~--~~~~~~~~~~~~~~~++~~~~~~~





reply via email to

[Prev in Thread] Current Thread [Next in Thread]