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: Neil Jerram
Subject: Re: [bug #22022] hashx-set! and -ref
Date: Thu, 17 Jan 2008 23:13:27 +0000
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

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






reply via email to

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