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 is too complicated


Ian Bicking <ian@bickiia.earlhall.earlham.edu> writes:

 > Maciej Stachowiak writes:
 > > There are a lot of data structures that are a collection of values
 > > indexed by keys. Association lists and hash tables, to name two useful
 > > ones, both have their place. Association lists are mainly useful in
 > > that they can be treated as lists directly, and Scheme's list
 > > operators can be used to do a lot of stuff quickly and easily. Hash
 > > tables are nice in that they have constant-time access.
 > 
 > I think it's confusing to have these two types.  A dictionary is a
 > dictionary, and I think it muddies the waters to have a bunch of types 
 > that are all equivalent to this concept.
 > 
 > A lot of my aesthetic opinions come from working in Smalltalk (Squeak, 
 > particularly).  The library system there is very elegant and
 > flexible.  One of best examples (or the thing most commonly used) is
 > the Collection classes.
 > 
 > They generalize all of the same operations that Scheme has over lists, 
 > and they do it uniformly for all collections.  If Guile could do the
 > same it would be really great.
 > 
 > That would mean having something like "map" that works for any kind of 
 > collection (list, vector, dictionary, etc) returning the same kind of
 > collection it receives.  The same for for-each, filter, etc.  Then the 
 > need for an association list would disapear.  It can also lead to very 
 > compact code that is still very readable, and makes learning how to
 > use a new type of collection extremely simple (since all the same
 > operations work on it).

You're talking about the common lisp sequence functions now, except
that you're mixing sequences & dictionaries.

Sequences    - lists, vectors, strings.
Dictionaries - hash tables, alists, trees.

-- 
Harvey J. Stein
BFM Financial Research
hjstein@bfr.co.il