Guile Mailing List Archive

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

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

Guile Home | Main Index | Thread Index