$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.
>> 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.
I know about it from Lisp, just wondering how/whether it would enhance
Ruby. I can see 'rest' as a companion to 'first' and 'last', but
going down the road of car, cdr and friends seems like a language
pastiche.
"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))...
"David A. Black" <dblack@wobblini.net> schrieb im Newsbeitrag
news:Pine.LNX.4.44.0406111136400.19371-100000@wobblini...
Hi --
> 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.
I know about it from Lisp, just wondering how/whether it would enhance
Ruby. I can see 'rest' as a companion to 'first' and 'last', but
going down the road of car, cdr and friends seems like a language
pastiche.
Sounds like a good suggestion for an RAA project "rlisp" to make lispers
feel at home with Ruby.