What's Lisp?

July 2014 · 2 minute read

Computer science is a bad term and doesn’t describe the deeper and hidden processes in the same way that Biology is not just about using microscopes and petri dishes. Computer science is more than just using a computer to solve problems.

Computer Science is beautiful in that the barrier between what you can imagine and what you can build is pretty thin. Unlike other disciplines, like engineering where making components has a physical limitation – you can’t stack a million amplifiers and expect zero noise propagation, whereas computer science has ideal components. Pure functions can be stacked and fed into each other without error propagating.

The idea of black box abstraction allows us to encapsulate ideas and pass them around.

In Lisp, as for any language, there are three main things.

1. Primitive Elements

What are the elementary building blocks of the language?

Here are some:

( ) + 5 and 2

2. Combinations

How do we combine elementary building blocks to form ideas?

(+ 5 2)

The + is the operator and takes two operands 5 and 2. Basic syntax for Lisp uses prefix notation. Parenthesis make combinations unambiguous and are necessary. A linear sequence of characters describes a tree of operations.

(+ 3 (+ 1 4) 7 8)

3. Abstractions

How do we abstract these combinations out?

(defn square [x] (* x x)) Clojure’s syntax

Here, we’re defining a process of taking some value x and multiplying * it by itself and naming it square. In essence, the symbol square is just a name for lambda(x), which is a signal that means make a procedure for x.

More generally, we are just dealing with the lambda calculus (λ-calculus). It is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. Three rules makes this beauty run:

  1. x Variable A character or string representing a parameter or mathematical/logical value
  2. (λx.M) Abstraction Function definition (M is a lambda term). The variable x becomes bound in the expression
  3. (M N) Application Applying a function to an argument. M and N are lambda terms.

The above is universal model of computation used to simulate any Turning machine. It was first introduced by mathematician Alonzo Church in the 1930s as part of his research of the foundations of mathematics.

Learn more about the lambda