What does "my other car is cdr" mean?

Can anyone well understand lisp to explain this joke to me? I read some functional programming languages ​​and know that CAR / CDR means reporting / decrement content, but I still don't understand the humor.

+83
lisp cons cdr
Dec 08 '09 at 5:26
source share
3 answers

In Lisp, the linked list item is called CONS. This is a two-element data structure called CAR and CDR for historical reasons. (Some regular Lisp programmers prefer to reference them using the FIRST and REST functions, while others, like CAR and CDR, because they agree well with pre-selected versions like (CADR x) ≑ (CAR (CDR x )).

The joke is a parody of the bumper stickers that you sometimes see on battered old cars: "My other car is a Porsche / BMW / etc."

My answer to this joke has always been "My other CAR is CADR. CDR is not CAR at all."

+123
Dec 08 '09 at 5:45
source share

Yes, definitely a geek joke.

Names taken from IBM 704, but this is not a joke.

A joke (bad) pun on "my other car is ___". But the joke is about recursion.

When you loop / manipulate / select / call / more in lisp, you use a combination of car (the first item on the list) and cdr (the rest of the list) to juggle with functions.

So, you have a car, but your other car is your cdr, because you can always get a car from cdr, because cdr always (in recursion) has more elements. Take it Another laugh?

You may have to learn lisp in order to actually laugh a little, or not. Of course, by that time you will probably find that you laughed randomly for no apparent reason, because:

Lisp makes you fixated.

+32
Dec 08 '09 at 6:05
source share

// From Schema
There are very few data structures in the schema, one of which is a tuple: '(first . second) . In this case, car is the first element, and cdr is the second. This design can be expanded to create lists, trees, and other structures.
The joke is not very funny.

+13
Dec 08 '09 at 5:30
source share



All Articles