car and cdr

Table of Contents

car and cdr are 2 main list primitives in lisp. In elisp, there are also cadr-like macros that is the short hand of using them in a row. Basically, everything in lisp is cons cells, consist of a car and a cdr, that is a head and a tail.

  cons cell '(1 . 2) list '(1 2) list of one '(1)
car 1 1 1
cdr 2 '(2) nil

cadr-like macros are interpreted as (car (cdr X)). They are useful to:

Backlinks

(2024 > 04 - April > <2024-04-04 Thu>)

Author: Linfeng He

Created: 2024-04-05 Fri 02:23