Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Lisp-1 and Lisp-2?

I have tried to understand the difference between Lisp-1 and Lisp-2 and how this relates to Clojure but I still do not understand properly. Can anyone enlighten me?

like image 995
yazz.com Avatar asked Jan 02 '11 13:01

yazz.com


People also ask

What is Lisp 2?

LISP 2 was a programming language proposed in the 1960s as the successor to Lisp. It had largely Lisp-like semantics and Algol 60-like syntax. Today it is mostly remembered for its syntax, but in fact it had many features beyond those of early Lisps.

Is clojure Lisp-1 or Lisp 2?

Since Clojure is a Lisp-1, (global) functions can be dynamically rebound (if they are marked as dynamic).

Is clojure Lisp?

Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy and a powerful macro system. Clojure is predominantly a functional programming language, and features a rich set of immutable, persistent data structures.


2 Answers

You might like to read this paper by Richard Gabriel. It is a summary of the issues that the Lisp community were discussing in Lisp1 vs Lisp2. It's a bit dense and slow moving in the first few sections, but is much easier to read by the time you get past section 5.

Basically, Lisp1 has a single environment that maps symbols to values, and those values can be either "regular" or functions. Lisp2 has (at least) two namespaces (symbols have a slot for their a function value and one for a regular value). So, in Lisp2, you can have a function named foo and a value named foo, whereas in Lisp1, the name foo can refer only to a single value (function or otherwise).

There are several tradeoffs and differences of taste between the two, but read the paper for the details. Christian Queinnec's book, "Lisp in Small Pieces" also has discussion of the differences woven through the text.

like image 110
Peter McLain Avatar answered Oct 08 '22 04:10

Peter McLain


According to wikipedia:

Whether a separate namespace for functions is an advantage is a source of contention in the Lisp community. It is usually referred to as the Lisp-1 vs. Lisp-2 debate. Lisp-1 refers to Scheme's model and Lisp-2 refers to Common Lisp's model.

It's basically about whether variables and functions can have the same name without clashing. Clojure is a Lisp-1 meaning that it does not allow the same name to be used for a function and a variable simultaneously.

like image 35
pauldoo Avatar answered Oct 08 '22 02:10

pauldoo