Arc Forumnew | comments | leaders | submit | krg's commentslogin
2 points by krg 5634 days ago | link | parent | on: Possible alternatives to car/cdr

Well, cdr can't really be spoken aloud unless you make up a way to pronounce it (which of course people do). And you could do the same for hp, rp, and the rest... adding an "o" sound gives some nice words, like hop, top, and fop. Kind of a Dr. Suess feel. :)

-----

1 point by krg 6038 days ago | link | parent | on: Function that takes any amount of arguments?

globalrev, this stuff confused me at first too.

So if you have (def foo (a b . c) ...stuff...) and you call (foo 1 2 3 4 5), a is bound to 1, b is bound to 2, and c is bound to the list (3 4 5).

And (def foo a ...stuff...) is just shorthand for (def foo ( . a) ...stuff...). So calling (foo 1 2 3) in this case means a is bound to the list (1 2 3).

-----

3 points by almkglor 6038 days ago | link

> And (def foo a ...stuff...) is just shorthand for (def foo ( . a) ...stuff...).

Technically wrong: ( . a) is invalid syntax. However it does help to think of it that way.

-----