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)


---------- Forwarded message ----------
Date: Thu, 19 Nov 1998 16:17:28 -0500 (EST)
From: Jay Glascoe <jglascoe@jay.giss.nasa.gov>
To: Maciej Stachowiak <mstachow@mit.edu>
Cc: guile@cyngus.com
Subject: Re: Scheme style auto-resizing hashtable (fwd) 

On Thu, 19 Nov 1998, Maciej Stachowiak wrote:

> 
> jglascoe@jay.giss.nasa.gov writes:
> > 
> > => (#0#)
> > 
> > the result is a list, its car is a pair, so after

I just think that's way cool.  Actually, I could just as well do this:

(set-car! el 'EAT-AT-JOE'S)
(set-car! el el)

Now Scheme programmers will never be able to find Joe's Diner!

> No offense, I find this whole destructive copying concept to be in bad
> taste from a Scheme point of view, and creating a random circular data
> structure is even worse. The potential slight memory savings to those
> few people who want to use destructive type conversions is not worth
> bloating the API and the memory image. I mean, even Common Lisp does
> not do wacky things like that. The GC is supposed to take care of
> things like this for you.

well, I'm definitely not offended.  As always, I'll quickly bow to any
pressure to change the hash table implementation  ;)  But I do have two
back-up lines of defense:

1) Leave the destructive thingies in the extension, but either
  a) hide their documentation so the casual user may never notice them
  b) leave them altogether undocumented.

2) Leave the code for the destructive things in the extension, but simply
comment out the bits that tell Guile to bind them to new procedures, i.e.
/* scm_make_gsubr (s_list2hash_tableq_x, 1, ...   */

It really isn't a big deal either way: leave 'em in or take 'em out.
After all, it only took 10 or so lines of C code to make them.


BTW, I'm working on "hash-table-stats" right now:

    /*  ((hash-table-type . hash-tableq) (auto-shrink . #t)
     *   (store-hash . #f) (number-entries . ??)
     *   (number-buckets . ??) (sum-square-bucket-size . ??)
     *   (sum-bucket-size . ??) (mean-bucket-size . ??)
     *   (variance-bucket-size . ??) (bucket-size-quartiles . (0 ? ? ?))
     *   (sum-square-nonempty-bucket-size . ??)
     *   (sum-nonempty-bucket-size . ??) (mean-nonempty-bucket-size . ??)
     *   (variance-nonempty-bucket-size . ??)
     *   (nonempty-bucket-size-quartiles . (? ? ? ?))
     *   (largest-bucket-size . ??) (largest-bucket-index . ??)
     *   (upsize-when . ??) (downsize-when . ??))
     */


	Jay Glascoe
	jglascoe@jay.giss.nasa.gov