Why Lispers like Lisp & family {Common Lisp, Clojure, Scheme, etc} ?
The following Clojure “Lispiness”:
- “Immutable” Data – protect from modifying data at run-time.
- Simple basic structures (list, vector, map, set) are enough
- Complex behaviour can be built with just simple functions.
- “It is better to have 100 functions operate on 1 data structure than 10 functions on 10 data structures.”
- Code = Data
- First-class functions: treat function as argument, or return a function:
eg. (map inc [0 1 2 3]) => (1 2 3 4). - Pure functions: 1) No side-effect like C/Java/etc; 2) “Referentially Transparent ” ie. always return the same result if given the same arguments.
- Powerful meta-programming: Macros
- Easy to extend : write a new language or dialect with Lisp.
- Structural Sharing: Old data structure and modified data structure shared within a Tri.
(John McCarthy 1960): 《Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I》
He defined the entire Lisp language in terms of only
◇ 7 functions (car cdr cond cons eq quote lambda) and
◇ 2 special forms (atom label)