Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The most minimal LISP? [duplicate]

Possible Duplicate:
How many primitives does it take to build a LISP machine? Ten, seven or five?

I am curious. What is the most minimal LISP, upon which all further features could be built? Ignore efficiency -- the question comes simply from a place of elegance.

If you awoke on an alien planet and were instructed to build the most minimal LISP that you could later build upon to implement any feature you liked, what would you include?

Edit: Clarification. My intent here is not to start a debate, rather I am considering implementing a minimal LISP and I want to understand how minimal I can go while still allowing the language I implement to be Turing complete, etc. If this turns out to be controversial I am sure I will learn what I wanted to learn from observing the controversy. :). Thanks!

like image 277
MikeC8 Avatar asked Jan 03 '11 23:01

MikeC8


People also ask

What is the most common lisp?

Interdental lisp – Interdental lisp is the most common and well-known type of lisp. It is caused by the tongue pushing forward between the front teeth. In the case of an interdental lisp, the s or z sound is pronounced like “th”.


2 Answers

Courtesy of Paul Graham, here's a Common Lisp implementation of John McCarthy's original LISP:

It assumes quote, atom, eq, cons, car, cdr, and cond, and defines null, and, not, append, list, pair, assoc, eval, evcon and evlis.

like image 111
grifaton Avatar answered Nov 26 '22 06:11

grifaton


Peter Norvig implemented a LISP interpreter in 90 lines of Python, and his subsequent article discusses in detail what you're asking. Well worth the read, IMHO.

http://norvig.com/lispy.html

I've got a feeling that his "sequencing" special form could be dropped if only function calls could take an arbitrary number of parameters.

(defun last (lst)
  (if (cdr lst) 
      (last (cdr lst))
      (car lst)))

(defun begin (:rest y) (last y))

But this would complicate function application.

like image 41
Jander Avatar answered Nov 26 '22 08:11

Jander