Reading — step 1 of 5
Read
Why Lisp?
Lisp (1958) is the second-oldest high-level programming language still in use (after Fortran). It pioneered:
- Garbage collection
- First-class functions
- Recursion as primary control flow
- REPL (read-eval-print loop)
- Code-as-data (homoiconicity)
- Macros (compile-time code generation)
Modern descendants: Common Lisp, Scheme, Clojure, Racket, Emacs Lisp.
Why is Lisp's syntax all parentheses?
(+ 1 2 3) ; 6
(* (+ 1 2) (- 5 3)) ; 6
(if (> x 0) "positive" "non-positive")
Each (...) is a list. The first element is the operation; the rest are arguments. EVERYTHING is this structure.
The benefit: code IS data. A program is a list. You can manipulate it like data, then evaluate. This makes macros trivial — your macro is a function that takes code (lists) and returns code (lists).
Hard to find another language where this is true. Most languages have separate syntactic forms (statements, expressions, declarations); Lisp has one form (the list). Simpler to parse, simpler to manipulate.
We'll build a tiny Lisp/Scheme in this course. It'll have arithmetic, conditionals, functions, closures, recursion, and macros. ~200 lines of Python.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…