1.1. Lisp Lists

Created Thursday 05 December 2013

;; "In Lisp, both data and programs are represented the same way; that is, they are both lists of words, numbers, or other lists, separated by whitespace and surrounded by parentheses."

;; List

;; The same list
'(rose violet daisy buttercup)

;; List
(+ 2 2)

;; List with a nested list
'(this list has (a list inside of it))

;; The printed representation of both atoms and lists are called symbolic expressions or, more concisely, s-expressions.

;; Numbers, symbols (single-quoted), strings (double-quoted) are the main atoms

;; "When you type a Lisp expression in GNU Emacs using either Lisp Interaction mode or Emacs Lisp mode, you have available to you several commands to format the Lisp expression so it is easy to read. For example, pressing the <TAB> key automatically indents the line the cursor is on by the right amount. A command to properly indent the code in a region is customarily bound to M-C-\. Indentation is designed so that you can see which elements of a list belong to which list—elements of a sub-list are indented more than the elements of the enclosing list."