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)



hjstein@bfr.co.il writes:
> Jay Glascoe <jglascoe@jay.giss.nasa.gov> writes:
> 
>  > On Tue, 3 Nov 1998, Ian Bicking wrote:
>  > > I think we have different notions of what dictionary-map should do.
>  > > IMHO it should return a dictionary.  Just like map is a function that
>  > > transforms one list into another, dictionary-map should transform one
>  > > dictionary into another.
>  > 
>  > woh.  I didn't even think of that.  Let me take a look at some other
>  > functional languages (Haskell and ML) and see what they do.
>  > 
>  > your suggestion makes "map" and "foreach" more consistent wrt each other.
> 
> The Common Lisp map fcn takes as 1st argument the kind of object to
> return:
> 
>    >(map 'string #'(lambda (x) (character x)) '(71 72 73 74 75))
>    "GHIJK"
> 

I've always had a problem with the use of quoted symbols and such to
represent types in CL, and with this syntax for `map' especially,
since it annoyingly clutters the common case of wanting to map to the
same type as the input sequence.

It is clearly useful to map directly from one sequence type to
another, but there's got to be a better way than this.

Another interesting issue is that mapping on hash tables is actually a
rather different operation than mapping on lists or vectors, since
hash tables have no ordering to preserve, and lists and vectors do
not, in the general case, have key-value associations to preserve.

 - Maciej