On Fri, 5 Oct 2001, Mark J. Reed wrote: > Well, "car" and "cdr" don't really fit; the key and value of a pair can be any > type of object, unlike the Lisp case where the cdr is always a list > (while the car can be either a list or an atom). Incorrect - "cdr" can be anything at all, just like in Perl 6. > But you can always define your own accessor methods with whatever > names you like. :) I can? How do I do that? > What's an associative list, how does it differ from an associative array, > and how is it wimpy? An associative list is a list of pairs that's used like a hash but requires a linear search for reads and writes. In Perl 5 it would look like: ( [ foo => 1 ], [ bar => 2 ] ) Assoc lists are commonly used in LISPish languages that lack convenient hashes. Emacs, for example, uses assoc lists extensively. > Perl hashes *are* associative arrays; Right. The difference between "array" and "list" when you start talking about LISPy pairs is significant. > we only started calling them "hashes" because it's shorter. Well, that and it's less confusing. We have a hard enough time keeping our arrays and lists separated without pulling in another data-structure. -samThread Previous | Thread Next