Dear OM Users
I am sorry for asking something very basic … whats the difference between first and car?
Thanks
Best L
Dear OM Users
I am sorry for asking something very basic … whats the difference between first and car?
Thanks
Best L
Dear L,
Both are the same concerning the resulting evaluation. They will return the first elmt of a list. However, car historically is more basic. The first more important expression in lisp are car and cdr.
car -> first of the list
cdr -> the rest of the list
It is because when you read lisp code, the first elemt of a list is either an expression (function, method or macro) and the rest are elemt as arguments,
YOu can also use nth which is really cool…
(nth 0 '(1 2 3 4)) => 1
(nth 2 '(1 2 3 4)) => 3
same thing as :
(third '(1 2 3 4)) => 3
Best
K
Dear Karim,
thanks very much for this clear very nice detailed description!
Best
L