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] |
Harvey J. Stein writes: > 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. Common Lisp thought of everything, didn't it? If only they knew when to stop... I think it is possible to unify sequences and dictionaries. There's two ways I can think of that you can view dictionaries as sequences: (1) associative arrays, (2) unordered lists of (key . value) pairs. (1) would imply that the sequence functions would act on the values in the dictionary, possibly recreating the key/new-value association after the transformation. (2) would imply that sequence functions would act on the (key . value) pair itself. Just like association lists. Unfortunately, both those concepts are valid and will give different results. I'd vote for (1) being the way sequence-functions-on-dictionaries are interpreted, with special functions to give (2). I don't see any actual reason for association lists except compatability. A hash-table should mimic all the association list behavior. Unfortunately, if you make sequence functions act like (1) you won't get this alist like behavior, you'll need seperate functions that act on the associations. Not a big deal, but then hash-tables wouldn't be drop-in replacements for alists. The other place where alists are different is being able to construct them manually, e.g.: '(('key1 . "value1") ('key2 . "value2")) I think allowing this is a bad thing anyways. An alist is only distinguished from a list in concept, not in type. My recent work with Tcl (which does this for everything) makes me think this is a bad idea because it cripples the ability for the language implementation to be intelligent and undoes some of the advantages of dynamic typing. <-------------------------------------------------------------------> < Ian Bicking | bickiia@earlham.edu > < drawer #419 Earlham College | http://www.cs.earlham.edu/~bickiia > < Richmond, IN 47374 | (765) 973-2824 > <------------------------------------------------------------------->