Lisp cons tree

I am still a lisp newbie, so I don’t know if this is cool or just wierd. Its something I made up a while back when I was first learning about cons associations:

Cons Table (this one is much better than below)


1

0

15

14

cdaaar

caaaar

cddddr

cadddr

caaar

cdddr

2

cadaar

|

|

cdaddr

13

cdaar

caar

cddr

caddr

3

cddaar

|

|

caaddr

12

car

(cons)

cdr

4

caadar

|

|

cddadr

11

cadar

cdar

cadr

cdadr

5

cdadar

|

|

cadadr

10

cddar

caadr

caddar

cdddar

caaadr

cdaadr

6

7

8

9

One thought on “Lisp cons tree

  1. I made the above diagram when I was first exposed to lisp in an attempt to understand all of the car/cdr functions. The problem with this model is that car and cdr are not equivalent, with car representing the first element of a list and cdr representing everything else. Apparently I will one day see functions as lists and lists as functions, so (+ 4 5 6) could simply be seen as a list where you evaluate car, the + sign and pass it cdr, which is 4 5 and 6, the values to be added.

Leave a Reply

Your email address will not be published. Required fields are marked *