"Patrick Gundlach" <clr1.10.randomuser / spamgourmet.com> schrieb im
Newsbeitrag news:m2r7smqm83.fsf / levana.de...
> Hello David,
>
> >> then we can even define Array#cadr and so on ;-)
> >
> > What problem would this solve?
>
> $USERDEFINED problem. In Lisp there are car, cdr and often(?) cddr
> cadr,... which access members of lists (cadr acesses the second
> element, cddr the third, fourth .... element). Absolutely no need to
> put this into ruby itself though. Its more a mnemonic and shorter to
> type. Example (setq mylist '((1 a))) then (car (cdr 'mylist)) is the
> same as  (caar 'mylist) which is 1.

Huh?  What am I missing here?  It seems (caar x) is short for (car (car
x))...

[1]> (setq mylist '((1 a)))
((1 A))
[2]> (car (cdr 'mylist))

*** - CDR: MYLIST is not a LIST
Break 1 [3]>
[4]> (car (cdr mylist))
NIL
[5]> (caar 'mylist)

*** - CAAR: MYLIST is not a LIST
Break 1 [6]>
[7]> (caar mylist)
1
[8]> (car (car mylist))
1

GNU clisp

    robert