tags : Programming Languages

What?

  • It’s not a specific language. It’s a family of programming languages characterised by the fact that all their computation is represented by lists. Clojure, Scheme, Racket, elisp, Common Lisp are some examples
  • You can define your own LISP

Homoiconicity

Lisp is homoiconic, which means that code and data share the same structure. Lisp macros operate on the abstract syntax tree (AST) of the code, which is essentially a data structure representing the code itself.

Syntax

  • See Expression notation
  • LISP goes around the issue of fixed Arity by explicitly marking both the beginning and end of each expression. i.e we traded fixed arity for required parentheses. So LISP syntax is a minor variant of the prefix notation.
      ; Lisp-style prefix notation; the same operator can be used
      ; for different numbers of arguments.
      (+ 1 2)
      (+ 1 2 3 4 5)
     
      ; Lisp equivalents of our first two examples:
      ; Prefix: + 1 * 2 3
      (+ 1 (* 2 3))
     
      ; Prefix: * + 1 2 3
      (* (+ 1 2) 3)

Ideas/Concepts

S-Expression

  • Symbolic Expression
  • A internal list structure that is built up recursively of numbers, symbols, and other lists