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.

martes, 12 de febrero de 2019

Ricky Hickey on Clojure Entry

Rick Hickey on Clojure

Rich Hickey the master mind behind Clojure introduces his creation which is a language based on Lisp, with a strong focus on concurrency and dynamic programming language for JVM.

Lisp is unique, it presents programs as data structures making "easier" to work with list, vectors, maps, etc. Another advantage of using Lisp is when using macros it's simpler than in other languages.

But why Rick has to create his own version of LISP?
Lisp seems promising but at the bottom, lacked of a robust platform, not to mention that it was tied to be a language for IA, so a "stucked" IA field made LISP stuck too.

But what about the innovations of Clojure:
Having programs represented as data structures means to have the potential to made programs to write programs, meaning meta programing will be simpler.
Some instructions are better encapsulated, Clojure manage that pretty well.
Clojure retained the power of Lisp but it's not just implemented, also it has the ability to "interact" with java problems adding dynamism instantly putting it out of the "island" Lisp were.
Also Clojure has simpler syntax.

What are the main differences between Lisp and Clojure?
Lisp has mutable structures which Clojure lacks (it has immutable structures, immutable data means don't make copies for instances, you only manipulate the path itself using the same "value", this avoid problems).
Clojure is modern with an API built upon abstractions behind all the date structures (meaning they are not just concrete structures)

Clojure provides some references types:
The Atom, which is synchronized and atomic (one at the time).
The Agent which is a synchronized and atomic.
The ref which changes inside a transaction, is synchronized and coordinated (it uses transaction memory).

Why a new language and not just add these functions on Lisp?
Because of the lack of idiomatic support, when programming with values it could be painful to use other Language than Clojure where it is "natural".


This podcast was made mainly to clarify doubts of the language program, giving a little bit of context, key attributes of the language, etc.

miércoles, 6 de febrero de 2019

Dick Gabriel on Lisp Entry

Dick Gabriel on Lisp


Lisp is a functional programming language, that uses a lot of nesting functions, one of the main advantages is that programs and data are basically the same which makes programming easier.

So for practical purposes we will introduce Dick Gabriel a programmer with a long carrier and an interesting background, he's also a researcher which happens to be a Lisp "expert".

Gabriel does a curious analysis about Lisp,  it's funny that a functional programming language happens to have a non functional-core, the imperative side of Lisp which has a set of instructions to offer, just like sequence. On Lisp everything is evaluated that's one of the main reasons  the first thing you learn will be to use quote on lists.

According to Gabriel the grand goal of Lisp was to serve as a support of AI community maybe because of it's nature of smart evaluation and the big scope it has. Lisp also introduces an interesting concept the Meta circular interpreter which basically refers to a program that "it's interpreted itself", imagine the odds.

As other languages Lisp also has Macros which is an operation that produces the expression you want, this makes the language so flexible. Other features are: continuation (a way of resuming in functions) and hygienic macros.

Well let's talk about Lisp on the main areas of use: Lisp is used as a research programming language, also for some systems just like the reservation system Gabriel mention.

In the end what happened with Lisp? AI winter happens, there was so much hype for AI and Lisp leading the "implementation" that in the end there was no business result and of course they blame Lisp, when the problem was the angle they were viewing it.

So for today Lisp is a great functional programming languages, basically being one of the tools for researching.