sábado, 13 de octubre de 2018

The Roots of LISP


This article explained us that John McCarthy published a paper where he showed how, given a handful of simple operators and a notation for functions, you can build a whole programming language. Its name was Lisp (List processing).

The article shows us a definition for expressions, which is an atom, a sequence of letters, or a list of zero or more expressions, separated by whitespace and enclosed by parentheses.
If an expression is a list, we call the first element the operator and the remaining are called the arguments.

A Function contains atoms and expressions, where in a function call each expression is evaluated. Parameters can be used as operators in expressions as well as arguments.
Adding periods at the end distinguishes primitive function from those defined in terms of them and avoids clashes with existing Common Lisp functions.
We can define functions that concatenate lists, substitute one expression for another, etc. We can also write a function that acts as an interpreter for our language. It means a function that takes as an argument any Lisp expression and returns its value.

Using quote,atom,eq,car,cdr, cons, and cond we can define a function that actually implements our language, and then using that we can define any additional function we want.

If we want a language for describing algorithms, we might want something more abstract, and that was one of McCarthy´s aims in defining Lisp. Lisp does not have side effects, no sequential execution, no practical numbers, and dynamic scope. But these limitations are remedied with surprisingly little additional code.

In this paper, McCarthy´s falsity is represented by f, not the empty list. If we can understand the McCarthy´s eval, we understand more than just a stage in the history of languages. Lisp is not something that McCarthy designed so much as something he discovered




No hay comentarios.:

Publicar un comentario