This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Scheme style auto-resizing hashtable (fwd)


Jay Glascoe <jglascoe@jay.giss.nasa.gov> writes:

 > constructors:
 > 
 > 	make-dictionary
 > 	make-dictionaryv
 > 	make-dictionaryq

These are for eq? eqv? & equal??  Why not the equivalent of:

   (define (make-dictionary &optional (comparison #f) (hasher #f))
      (if (not comparison)
          (begin (set! comparison eq?)
                 (set! hasher hasher-for-eq)))
      (if (not hasher)
          (cond ((eq? comparision eq?)
                 (set! hasher hasher-for-eq))
                ((eq? comparision eqv?)
                 (set! hasher hasher-for-eqv))
                ((eq? comparision equal?)
                 (set! hasher hasher-for-equal))
                (else
                 (error "I don't recognize your comparison fcn so you must provide a hasher too."))))
       (return the dictionary based on comparison and hasher))

-- 
Harvey J. Stein
BFM Financial Research
hjstein@bfr.co.il