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

*To*: "Steve Bacher (Batchman)" <SEB1525%draper.com@NSS.Cs.Ucl.AC.UK>, SEB1525%draper.com@NSS.Cs.Ucl.AC.UK, common-lisp@sail.stanford.edu*Subject*: Re: Implementing :TEMPORARY hash tables at the Lisp level?*From*: Jeff Dalton <jeff%aiai.edinburgh.ac.uk@NSS.Cs.Ucl.AC.UK>*Date*: Wed, 7 Sep 88 18:26:30 BST*In-reply-to*: Steve Bacher (Batchman)'s message of Wed, 7 Sep 88 07:52 EDT

> Just a question. If one were to implement :TEMPORARY hash tables as > described - i.e. testing to see if the test were #'EQ or #'EQL - well, > just how does one code such a test in CL? Presumably you'd have code like > > (case test > ((#'eq #'eql) (make-em-collectible)) > ((#'equal) (dont-make-em-collectible)) > (otherwise (make-em-whatever-you-want))) > > But... there is no way of testing equality of functions, lexical closures, > or what have you, in CL. So how can this possibly be implemented? This problem already exists for hash tables: something must see whether the :TEST argument is EQ, EQL, or EQUAL. I suspect this involves code like the following: (cond ((or (eq test #'eq) (eq test 'eq)) ...eq hash table...) ((or (eq test #'eql) (eq test 'eql)) ...eql hash table...) ((eq (eq test #'equal) (eq test 'equal)) ...equal hash table...) (t ...whatever...)) Functions can be compared with EQ, EQL, and EQUAL, but the meaning is not "do they compute the same (mathematical) function". Code like the following will not work: (make-hash-table :test #'(lambda (a b) (eq a b))) -- Jeff

**Follow-Ups**:**Re: Implementing :TEMPORARY hash tables at the Lisp level?***From:*Barry Margolin <barmar@Think.COM>

- Prev by Date:
**Re: Hash Tables and GC** - Next by Date:
**Re: Hash Tables and GC** - Previous by thread:
**:TEMPORARY hash tables; weak pointers** - Next by thread:
**Re: Implementing :TEMPORARY hash tables at the Lisp level?** - Index(es):