Lisp
Overview
Lisp family languages (Common Lisp, Clojure, Scheme, Racket) center on S-expressions, macros, and homoiconicity, code as data. They excel at symbolic computation, DSLs, and interactive development through REPL-driven workflows.
Key concepts
- S-expressions:
(operator arg1 arg2)uniform syntax. - REPL: Read, eval, print loop for exploration.
- Macros: Compile-time code generation (not just functions).
- Garbage collection: Typical runtime-managed memory.
- Dialects: Different Lisps have distinct object systems and libraries.
Eval loop
Sample: Scheme-style definitions
(define (square x) (* x x))
(define (sum-squares a b)
(+ (square a) (square b)))
(sum-squares 3 4) ; => 25