miércoles, 27 de febrero de 2019

The Roots of Lisp Entry

The Roots of Lisp

"In 1960, John McCarthy published a remarkable paper in which he did for programming something like what Euclid did for geometry. He showed how, given a handful of simple operators and a notation for functions, you can build a whole programming language."
He called this language Lisp, for "List Processing". 

According to the author, by the time the article was written (2002) there was 2 clean consistent models of programming, the C model and the Lisp model. With the increase of the power on the computers, the new languages being developed have been moving toward the Lisp model. Some of them grab parts of both. The article McCarthy published has a lot to do with this, since the way it dissects Lisp.

One of the key features of Lisp is that it can be written in itself (reviewed later).
To understand how John sees Lisp we have to know there are Seven Primitive Operators in Lisp, here they are :

Expression, which is either an atom (a sequence of letters) or a list of zero or more expressions, separated by whitespace and enclosed by parenthesis.
  1. (quote x) returns x.
  2. (atom 'a) returns the atom t if the value is an atom or the empty list, otherwise ().
  3. (eq x y) returns t if the values of x and y are the same atom or both the empty list, () otherwise.
  4. (car x) expects the value of x to be a list, and returns its first element.
  5. (cdr x) expects the value of x to be a list, and returns everything after the first element.
  6. (cons x y) expects the value of y to be a list, and returns a list containing the value of x followed by the elements of the value of y (like concatenate).
  7. (cond (p1 e1) ... (pn en)) The p expressions are evaluated in order until one returns i.
For denoting functions, a function is expressed as (lambda (p1 ... pn) e) where p1 ... pn are atoms (called parameters) and e is an expression, we use label to call the function.

All this tools grant us with the capacity of writing a function that acts as an interpreter for our language, a function that takes as an argument any Lisp expression, and returns its value. This capacity is basically the eval function McCarthy defines on his publication.

Implementing the eval function add more possibilites to Lisp, now we can define any additional function we want (so similar to the Turing machines purpose).

It's not a secret Lisp lacks of some important features, it has no side-effects, no sequential execution, no practical numbers, and dynamic scope. But these limitations can be remedied with little additional code.

The author emphasizes that Lisp is not intrinsically a language for AI or for rapid prototyping. Lisp is what you get when you try to axiomatize computation.

Paul goes way to deep to the Roots of Lisp, for that he analyzes what McCarthy published, he in fact reach the bottom and explain the key points of Lisp, just like the eval function, what's needed, etc. This article clarifies even more about some misunderstandings of Lisp and his capabilities, it's well managed and now it's a good source when starting learning Lisp language.

No hay comentarios.:

Publicar un comentario