DEV Community

Cover image for The Idea of Lisp

The Idea of Lisp

Eric Normand on December 13, 2016

LISP. It conjures up visions of a bygone age of computers the size of refrigerators, ALL CAPS CODE, and parentheses. Oh! so many parentheses! So wh...
Collapse
 
ben profile image
Ben Halpern

It's hard for me to even conceptualize writing a program without the concepts introduced by Lisp. These ideas are truly enduring. Why is it that we don't put more focus on this history when we teach CS?

Collapse
 
koyedele profile image
Kunle Oyedele

"Why is it that we don't put more focus on this history when we teach CS?" I couldn't agree more. It appears "Computer Science" is the one "science" in which we don't really consider the history of the field itself, and the people who made significant contributions to it. Maybe that's why we keep reinventing the wheel.

Collapse
 
tbodt profile image
tbodt

I recently learned Lisp and thought it was the stupidest language in the world because it has no random access data structures, which are crucial to computers actually working. That's still true, but now I see that there are other things about the language which makes it great.

Collapse
 
davidawheeler profile image
David A. Wheeler

The Lisp-based languages that people generally use have random access data structures - they just may have different names than you're expecting. Common Lisp has the general construct of an array, and a specialized version called a vector. In Scheme they are called vectors: r6rs.org/final/html/r6rs/r6rs-Z-H-... . Similarly, Clojure has vectors.

Collapse
 
metacritical profile image
Pankaj Doharey

That is not true, Lisp is not all about linked list. Optimised maps exist in all major lisps which are essentially Random access. Also Self balancing binary search trees can be easily implemented which are a good compromise, the only community that is keen on Random Access DS is the Haskell community which spends all its energy and resources in writing research papers on "Sieve of Eratosthenes" instead of doing something more productive.

Collapse
 
ben profile image
Ben Halpern

But isn't that the whole point? I would expect Lisp, in practicality, to be kind of stupid, because everything that came after it is essentially building off of it. But the idea of Lisp and the history of how it came about is every bit as fundamental as other concepts that get way more attention.

Thread Thread
 
psionski profile image
Vladislav Zorov

And you'd be oh so wrong :)

Lisp doesn't just come first, it also evolves fastest (remember the article above? That it encourages experimentation in language design?)

For example the OOP features of Common Lisp (CLOS) are still unmatched by any other language. The "exception handling" (called conditions) are also much more advanced than elsewhere.

And what didn't originate in Lisp, Lisp can often trivially steal. There are libraries on the Internet that can make it have the features of pretty much any language and paradigm you want (coroutines, logic programming, whatever).

 
tbodt profile image
tbodt

Exactly.

Collapse
 
psionski profile image
Vladislav Zorov

It's not that it doesn't have them, they're just not the preferred solution. Common Lisp has arrays (fixed size or dynamic), hash tables and everything - you use them when optimizing your program's performance.

Collapse
 
ericnormand profile image
Eric Normand

What dialect of Lisp did you use? Are you sure it didn't have random access data structures? Of course Lispers know the importance of indexed arrays.

Collapse
 
ferakpeter profile image
Peter Ferak

Great post about the history. In terms of modern development you could mention leiningen and figwheel, and all the other great dev-tools that have come out of the Clojure community and are in my opinion the most mature and modern eco-system at the moment.

Collapse
 
ben profile image
Ben Halpern

Every time I read about Clojure, I get interested in trying it out, and I never end up doing that. I'm thinking ClojureScript is going to be my entry point. I've seen David Nolen show off some of the ideas, tools, etc., which definitely has me excited.

Collapse
 
coopsource profile image
Co-op Source

I've written code in almost every language in use today and many long since forgotten. I was exposed to LISP in grad school (CS) but couldn't get past the parens and odd fn names (car cdr etc.) My lasting impression was of a powerful language (solved nine puzzle very easily) but that it was awkward to work with.

I've since learned Clojure and am a complete convert. On so many levels Clojure got it right, especially forgoing the awkward fns and adding array/map syntax support. It isn't perfect but it's rigor and reach are unparalleled in any other language.

I strongly recommend giving it another try. If you need help the community is very open and helpful. Also, tooling has greatly improved. Tip: if you aren't already an emacs developer, try Cursive.

Collapse
 
ericnormand profile image
Eric Normand

Another good one is ClojureScript for Skeptics by Derek Slager.

Collapse
 
scottpjones profile image
Scott P. Jones

I learned more in one semester at MIT learning Lisp (MacLisp, moving to Scheme) than I had in the 7 years before that taking classes at the state university where I grew up (using Fortran IV and PL/I). The concepts that I learned (especially from Scheme) have held me in good stead for 36 years.
In fact, these days, I'm working 100% of the time using Julia, which is a very interesting language that inherits quite a lot from Scheme (two things to note: the parser (and AST lowering code) is actually writting in femto-lisp (which is a small, fast dialect of Scheme written by Jeff Bezanson), also, one of the 3 people of the panel at Jeff's PhD thesis defense was none other than Gerald Sussman ;-) ).

Anybody who loves the idea of Lisp, should definitely check out julialang.org/

Collapse
 
vyodaiken profile image
victor yodaiken

"I mentioned this before, but it bears repeating: programmers were following math's lead and using one-letter variable names before McCarthy came along. "

You have overstated the case here, in particular. Certainly FORTRAN had multicharacter variable names, IAL did too as did ALGOL 58. I am pretty sure Hopper's Autocode did.

"Yes, John McCarthy invented the conditional expression. He lobbied the Algol committee to add them to Algol, from which most languages got them today."

According to McCarthy, the conditional expression in Algol was proposed by Backus. See footnote 2 in
edge.cs.drexel.edu/regli/Classes/L...

Also McCarthy did not develop LISP on his own, he had a number of collaborators.

Collapse
 
ericnormand profile image
Eric Normand

Thanks for the clarifications and discussion. It's always good to read deeper and you've challenged me to clarify further.

"You have overstated the case here, in particular. Certainly FORTRAN had multicharacter variable names, IAL did too as did ALGOL 58. I am pretty sure Hopper's Autocode did."

Yeah. Fortran allows 1-6 character variable names. But look at the code. Lots of X, Y, I, J, K for variable names. That's what I meant: they were just following math's lead and rarely naming variables the way we would today.

"According to McCarthy, the conditional expression in Algol was proposed by Backus. See footnote 2."

Yes, the footnote is correct but very terse and can read ambiguously. McCarthy's syntax was not chosen, but the idea for how it worked was. Backus merely suggested new syntax(if..then..else..). See nyu.edu/classes/jcf/CSCI-GA.2110-0...

"Also McCarthy did not develop LISP on his own, he had a number of collaborators."

No argument there. He was working closely with a number of very smart people during the Dartmouth Summer Research Project, and McCarthy has been very forthcoming about the influences. I will grant that I took some poetic license to shorten the story. The first Lisp was actually written by Steve Russell from McCarthy's design.

However, as far as I'm aware, no one has ever contested him for being the inventor of Lisp. For those reading, I suggest reading the following if you're interested:

www-formal.stanford.edu/jmc/histor...
infoq.com/interviews/Steele-Interv...

Collapse
 
vyodaiken profile image
victor yodaiken

The book excerpt is great. Who knew that McCarthy, who I used to argue with online in the early days of USENET and was deeply right wing, had communist labor union organizer parents and had been inspired by a Soviet Era children's science book? I had to look it up: ebay.co.uk/itm/100-000-Whys-A-Trip...

Collapse
 
ericnuggets profile image
Eric Anderson

great informative background on Lisp. Also appreciate your blog and emails which always expand my thinking with new ideas and context.

do you have any thoughts on status of Clojure on CLR? it seems to be both acknowledged by its creators and deemphasized as well.

Collapse
 
ericnormand profile image
Eric Normand

Thanks!

Clojure on CLR just needs more work. Rich Hickey is the original creator but got tired of doing everything twice to support JVM and CLR. There are maintainers but I think they need more help. Arcadia is Clojure + Unity3D, which is CLR.

Collapse
 
coopsource profile image
Co-op Source

FYI: One data point, we've been using Arcadia (and ClojureCLR) and it seems to "just work." I think there may be some newer Clojure features that may not be there yet but I haven't run across any (yet.)

Collapse
 
melriffe profile image
Mel Riffe

First, thanks for the article Eric.

As someone that loves history, in general, I really love learning stuff like this. As a software developer that loves history, it's great to learn about all the things we now take for granted.

Second, Lisp, now Clojure, is at the top of my "To Learn" list. I hope to get started this year. For me it's a foundational thing. You see, I started my professional programming career writing Smalltalk. And because of Smalltalk I feel I'm 'different' kind of OO programmer. Learning Lisp, I hope, will help me learn about Functional Programming.

I feel, as a professional programmer, you should never stop learning; you should remain insatiably curious.

Thanks for feeding my curiosity!

Collapse
 
ericnormand profile image
Eric Normand

Awesome, Mel!

I think Lisp will help you learn FP, but it will also make you a 'different' kind of Functional Programmer in the same way Smalltalk made you different.

Eric

Collapse
 
jdunruh profile image
John Unruh

I remember learning about lisp, and how to use the primitives to write the rest of lisp 1.5 in those primitives in my matters programming languages class ( thanks Tom Murtaugh). I always found lisp interesting, but at the lisp 1.5 level, it isn't all that easy to use. Fast forward to common lisp or clojure, and usability increases, but there is still a big learning curve as it isn't like other languages. In essence, you are writing the ast directly rather than having a compiler move from a vaguely English form to the ast. In the end, the syntax is a plus because it makes macros a lot easier.

One note, I believe oop is in similar 67, which came before Smalltalk.

Collapse
 
syncsynchalt profile image
Michael Driscoll

Thanks for the article, Eric! I have no lisp background and it looks like you've convinced me to address that; I wrote up my experience implementing lisp as described in the original paper here.

Collapse
 
bcherny profile image
Boris Cherny

Out of curiosity, what's the alternative to if/else? Assuming polymorphism wasn't around in the 50's, did people express the idea of conditional execution based on the result of evaluating some expression using and/or? Does this mean that lazy evaluation was around before conditionals?

Collapse
 
ericnormand profile image
Eric Normand

Something like you have in assembly: a conditional GOTO that jumps if the argument is equal to zero. Algol actually had a three-way conditional that jumped whether the argument was zero, positive, or negative.

Collapse
 
davidawheeler profile image
David A. Wheeler

"Oh! so many parentheses!" is a common complaint, and is probably one of the most common reasons people ignore Lisp. Readability matters. If you're interested in Lisp, but want to use a more readable notation that retains Lisp's power (including homoiconicity), see the readable Lisp s-expressions project.

Collapse
 
bigos profile image
Jacek Podkanski

Give yourself two weeks and the parentheses will not be a problem. Adapting editors or changing to an editor that handles parentheses well also helps.

Collapse
 
krainboltgreene profile image
ⓚⓤⓡⓣⓘⓢ

The new hot language will be gone in 15 years.

Do you have any examples for this huge prediction? Even un"hot" languages, like MUMPS, are still used to this very day.

Collapse
 
ericnormand profile image
Eric Normand

By "gone" I mean "not hot" anymore.

Collapse
 
bigos profile image
Jacek Podkanski

MUMPS is still being used. I used to work for a company that still uses it for its flagship product.

Collapse
 
jacmoe profile image
Jacob Moen

Gone from the radar, I assume :)

Collapse
 
theminshew profile image
Michael Minshew

Woke up at 3am for God knows what reason wanting to learn lisp. Working through "land of lisp" and thought I bet dev.to has some lisp articles. As Always I was not disappointed.

Collapse
 
lucrp profile image
Lucas Ramos Paiva

I was reading some pages from Structure and Interpretation of Computer Programs and I even installed Emacs and started to learn LISP from it. SICP is an interesting book, but it was hard to me. I will try it out some other time.

Collapse
 
metacritical profile image
Pankaj Doharey

Its like a Drug once you program in lisp everything else seems so complicated with too much syntax, while lisp essentially has none.

Collapse
 
alephnaught2tog profile image
Max Cerrina

Missed this the first time around and just found it and TOTALLY made my week!

Collapse
 
johnthad profile image
Thad Humphries

I learned Lisp in grad school 25+ years ago, and have Albee disappointed that no employer ever wanted to use it.