bug-guile
[Top][All Lists]
Advanced

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

Re: [bug #22022] hashx-set! and -ref


From: Gregory Marton
Subject: Re: [bug #22022] hashx-set! and -ref
Date: Thu, 17 Jan 2008 19:30:08 -0500 (EST)

Thank you. I did something far less elegant already, but it's good to have this. I should also read all of my email before responding. :-)

Best wishes,
Grem

Gregory Marton <address@hidden> writes:

As an enhancement request, it would be nice for the common case to be able to
pass a hash-function argument and assoc to make-hash-table or to have a
(make-hashx-table hash assoc [size]), and in either case to remember the hash
function so that resize works correctly.

Last email on this topic for tonight...!

Note that anyone wanting to implement this "saner" interface can
straightforwardly do so in Scheme:

(define hash-table-hash-fn (make-object-property))

(define hash-table-assoc-fn (make-object-property))

(define (make-hashx-table hash assoc . args)
 (let ((t (apply make-hash-table args)))
   (set! (hash-table-hash-fn t) hash)
   (set! (hash-table-assoc-fn t) assoc)
   t))

(define (hashx-table-ref t key)
 (hashx-ref (hash-table-hash-fn t) (hash-table-assoc-fn t) t key))

etc.

Regards,
      Neil






--
------ __@   Gregory A. Marton                http://csail.mit.edu/~gremio/
--- _`\<,_                                                                .
-- (*)/ (*)               Truth, Beauty, Love, and Darwinfish!
~~~~~~~~~~~~~~~~-~~~~~~~~_~~~_~~~~~v~~~~^^^^~~~~~--~~~~~~~~~~~~~~~++~~~~~~~





reply via email to

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