Guile Mailing List Archive

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

Re: Scheme style auto-resizing hashtable (fwd)



On Fri, 6 Nov 1998, Maciej Stachowiak wrote:

> I am a fan of minimal APIs (in the sense of "as small as possible but
> no smaller"), and I think performance gains in particular cases that
> are likely dependent on Guile's current GC (which is already getting
> rewritten) are a bad reason to add more calls to an API.

12 essential procedures, not counting the "hash-table''/'v'/'q'/'x'"
duplication.

hash-table? object

make-hash-table
make-hash-tablev
make-hash-tableq
make-hash-tablex user-equal? user-hasher

hash-table-enable! hash-table option
hash-table-disable! hash-table option
    "option" should be one of 'auto-shrink, 'store-hash.

hash-table-insert! hash-table key value
hash-table-lookup hash-table key [not-here]
hash-table-remove! hash-table key [not-here]

hash-table->list hash-table [unwrapper]
    return a list with elements (unwrapper key-value-pair)
    "unwrapper" defaults to identity

list->hash-table list [wrapper]
list->hash-tablev list [wrapper]
list->hash-tableq list [wrapper]
list->hash-tablex list [wrapper]
    return a hash-table with key-value pairs (wrapper list-element)
    "wrapper" defaults to identity.
    (wrapper list-element) must be a pair for all list-elements.

hash-table-copy hash-table [key-value-pair-transformer]
    return a new dictionary with key-value-pairs
    (key-value-pair-transformer key-value-pair)
    "key-value-pair-transformer" defaults to
    (lambda (key-value-pair)
      (cons (car key-value-pair) (cdr key-value-pair)))

hash-table-add-pair! hash-table pair

hash-table-for-each hash-table procedure
    apply "procedure", a procedure of two arguments, to all of
    "hash-table"'s keys and values  (lambda (key value) (...))

> 
>  - Maciej
> 
> 

	Jay Glascoe
	jglascoe@jay.giss.nasa.gov


Guile Home | Main Index | Thread Index