Turning Off Lisp Semantics

Published on November 7, 2019
Last updated on March 6, 2020
Categories: computing and lisp
Debuggery

Some fields hidden!

The reason Lisp is special is because you can TURN OFF semantics.

(+ 1 1) is pure form. (+ 1 1) is syntax. (+ 1 1) is a syntactic expression: it has structure. But, until we evaluate it, it doesn't have meaning. [It might appear to be "add one and one," but in a programming language1 focused on bits and bytes, (+ 1 1) might well be the command to put together two bits, resulting in 11.]

In all the Lisp-family languages I know of, because they are programming languages, and by default the programmer expects to evaluate syntactic expressions, the default notation for an expression which will be evaluated is simpler than that for one which will not be evaluated.

The notation given above is the traditional notation for an expression which will be evaluated by the Lisp system. (+ 1 1) evalutes to 22.

The notation for an unevaluated expression is '(+ 1 1). But, "unevaluated" isn't quite the right word here. It will be more helpful to consider (+ 1 1) as evaluating to itself.

You can think of that single quotation mark like a switch which turns off evaluation. Once that quotation-mark switch is flipped, the following expression no longer means anything. It's pure syntax. The result of evaluating it will depend on the environment in which it's evaluated: if you redefine "+" to do subtraction, the result of evaluating (+ 1 1) in that environment will be 0.

2020-03-06T10:08:25-0800

(all (anything where the first word in operator position is treated by looking up, within a table, how to output it e.g. (:span (children)) becomes children (anything else gets rendered as normal text into a :p tag or something or something similar) (this s-expression is an example) )

  1. This language might be either general-purpose or "domain-specific;" it might be self-hosting or it might be a dialect inside another language. And isn't a programming library just a collection of new words in a familiar language? Ones with commentary, and notes on usage, and perfectly explicit definitions?

  2. Setting aside questions of integers vs floating-point numbers and other such things.

Maxwell Joslyn's Test Website

GitHub, Email