Skip to main content

The Roots of LISP

The Roots of LISP, by Paul Graham.


This is  one of the hardest readings that we had to do in the course. During our programming languages course we have been working with Clojure, a new dialect of LISP that makes everything a little bit more readable. Trying to extrapolate everything we know in Clojure to LISP is not hard, but it's not trivial either. So if you want to go ahead and read The Roots of Lisp, by Paul Graham, you better have a solid foundation of Clojure or any LISP dialect that you are familiar with.

So after giving you this brief introduction let's get right into a review to this reading.

Paul Graham made a review of what John McCarthy found when he discovered this new dialect for making mathematical notation more readable. Let's get into the main points of the reading, so that you can go ahead and read it again by yourself.

1.- Using lists for both data and code.

One of the things that's probably the most weird to understand is this little sentence right here, using lists for both data and code.

To understand this you have to understand first how the quote operator works. The quote function simply returns the value that it receives unevaluated. For example if we write:

> (quote '(+ a b))

=>'(+ a b)


As you can see, the quote operator left everything it received as an argument unevaluated, even though what it received was actually a function that's supposed to sum a and b. Which leads us to the second thing you have to understand.

Functions are called through lists. As a matter of fact everything in Lisp is translated into lists and understood through them. Consider this examples:

> (+ 1 2)
=> 3

So functions are understood through lists as well, where the first element of the list is the function to be applied and the rest of the elements of the list is the arguments that the function uses to execute.


Now consider the fact that you can leave certain parts or certain function calls unevaluated, that gives the programmer the possibility to understand how Lisp code is made internally, which is a very powerful function because then you can write interpreters for practically any other Lisp dialect without having to dig a lot into them.


Comments

Popular posts from this blog

Revenge of the nerds, by Paul Graham.

So, once again we go to Paul Graham and his absolute amazing opinions on lisp. He understands the difficulty in changing the industry, but faces this with a good sense of humor and courage. You can check out his blog entry here . Taking it to the next level So the story goes like this. Michael Phelps went out there to change the world of an olympic sport. And did. Only he and his coaches know what he is doing differently but definitely, he is. Michael Phelps is such a good example because before Phelps, it was very rare to think of a swimmer that could do all the strokes in a competition, from crawl from breast stroke to his olympic record breaking butterfly stroke. In a sense, Phelps is like lisp. Phelps came to the 2004 Athens olympic games as a kid, he was only 19 years old, but everyone knew he had the chance to break the olympic record for 7 gold medals in the same event. He went on it and won 8 of them. So... what is he doing differently than any other swimmer? How long does...

The promises of functional programming, by Konrad Hinsen

Hello and welcome to another post in my blog about functional programming. In this space we review several advances and insights made possible by the functional programming paradigm as a relatively new way to solve computational problems. In this occasion,  I read " The promises of functional programming ", by a scientific computer researcher named Konrad Hinsen. In this paper, we can learn some core differences between the object-oriented style programming and the functional style-oriented programming. In general, we have spoken before about this differences throughly, which include: There are almost no  variables  It's power relies on  pure functions . No for loops, everything is implemented through recursion. Parallelization and concurrency  optimizations. This main reasons are several that show that functional programming is essential, in my opinion, as a compliment to object - oriented languages, like Java. Let me explain each point, befor...

Language as the Ultimate Weapon

During this blog entry, I was asked to reflect on one question: Why is the Nineteen Eighty-Four novel by George Orwell relevant to a student taking the Programming Language course? In case I haven't told you before, in my programming languages course we were reading 1984 by George Orwell. The book is about a man that is trapped in a totalitarian system. He is just, let's say, another gear in a super huge mechanism. This man, Winston Smith was a little bit different from everybody else. He saw what others didn't want to see about their way of living. He saw the little mistakes that the system made and how they deprived them of their humanity. It seemed like everybody else just wouldn't notice that they were being lied to. In the book, the party had three slogans that were supposed to guide the way people living: War is Peace, Freedom is Slavery, and Ignorance is Strength. Let's take a look at the first slogan first: War is Peace. By making the people beli...