2 ms·
Foremost, it's just nested lists and not a tree. We are talking about lists and atoms. We are then talking about list operations, like getting list elements, ap
by lispm 3y ago
Foremost, it's just nested lists and not a tree. We are talking about lists and atoms. We are then talking about list operations, like getting list elements, appending lists, reversing lists, listing things, nesting lists and atoms, mapping lists, matching lists, destructuring of lists, ...
This is a list:
(munich frankfurt dresden)
This is a list of lists
((münchen :state Bavaria)
(frankfurt :state hessen )
(dresden :state sachsen))
If we look at the level of conses and atoms, then we see a binary tree and operations: car, cdr, cons, ... Lisp is there a low-level language: lists are made of simpler building blocks: two-item nodes and atoms.
This is a tree:
((a . (10 . nil))
.
((b . (20 . nil))
.
nil))
The dot is an infix syntax element for a cons cell.
Which as a nested list is shorter written as
((a 10) (b 20))