224: Lisp

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
Lisp
We lost the documentation on quantum mechanics. You'll have to decode the regexes yourself.
Title text: We lost the documentation on quantum mechanics. You'll have to decode the regexes yourself.

Explanation[edit]

Lisp is a computer programming language with simple, highly regular syntax. The language's most notable feature is that programs take the same form as the language's primary data structure (the linked list). This blurs the line between code and data and permits programs to inspect and even alter their own source code, thereby opening up deep opportunities for metaprogramming. Lisp is also a functional programming language (though not purely functional, as some more recent languages are), meaning that programs are expressed in terms that are simple elaborations or extensions of the lambda calculus, a formal mathematical model of computation. This gives programs written in functional languages such as Lisp a distinctively abstract, mathematical form that is commonly considered difficult to fully grok (see 1270: Functional).

The phrase A suffusion of blue is a reference to Douglas Adams' book The Long Dark Tea-Time of the Soul. In it, an I Ching calculator calculates that everything above the value of 4 is a suffusion of yellow.

In the comic, Cueball marvels at the fundamental and complete nature of the language of creation that he sees in his dream. In the Lisp programming language, "car" is a primitive (i.e. basic) function that produces the first item in a list. The line "My God, It's full of 'car's" is a pun, most likely referring to the movie 2010: The Year We Make Contact, the sequel to 2001: A Space Odyssey. In the book 2001: A Space Odyssey, when astronaut David Bowman accidentally activates a star gate, he exclaims as he enters it "The thing's hollow — it goes on forever — and — oh my God - it's full of stars!", although he does not say anything in the first movie during the final sequence. This likely also includes a transitive reference a chapter in The Little Schemer, a popular introductory Lisp book, called *Oh My Gawd*: It's Full of Stars, also itself a reference to 2001. From the shape of the two discs in front of Cueball it may also be referring to Terry Pratchett's book the last hero where the last survivor of a ship that went under the disc says oh my god its full of elephants

In the second panel, Cueball remarks that, "At once, just like they said, I felt a great enlightenment." This is a reference to a pattern of observations among programmers and computer scientists that while Lisp often seems alien or arcane — even deliberately so, even to experienced hackers, even with repeated exposure over time — truly understanding Lisp in a deep, non-superficial way, results in a profound epiphany, a sudden and abiding illumination wherein one's preconceived notions about computation and programming are fundamentally transfigured, oftentimes over the course of a very short span such as during a single all-day hacking binge. Lispers commonly describe the experience as being akin to learning programming for the first time again; Daniel P. Friedman (author of much ground-breaking research and many popular introductory texts on Lisp and programming language design) described it as "[learning] to think recursively," and contended that "thinking about [functional] computing is one of the most exciting things the human mind can do."

Cueball's remarks about patterns, metapatterns, and the disappearance of syntax are reactions to the elegant simplicity of the Lisp programming language, in which it is relatively easy to build immensely sophisticated programs using simple recursive elaborations of structure. This is fundamentally unlike the much more typical and common imperative programming languages, in which programs are written as chains of instructions for the machine to follow.

Cueball then, in the third, borderless panel, muses that this has to have been the language the gods used to create the universe, which is a pretty bold statement that Cueball seems to make because he views Lisp as something flawless and perfect, as these are qualities that often subjectively apply to things that people, like Cueball, claim to have been made or used by gods or other holy beings.

A cloudy, bearded man, presumably representing God, states that this is untrue, and after a surprised inquiry from Cueball replies that the universe was actually hacked together with the programming language Perl. Perl employs an idiosyncratic syntax that borrows liberally from a number of other languages. Although a versatile language often employed for assembling projects quickly (the much-loved Programming Perl introduces it as "[the] language for getting your job done"), Perl has a reputation for being ugly and inelegant, partly as a result of its pidgin-like fusion of many inconsistent language elements and code styles. It was famously described as a "Swiss-Army chainsaw," because it is very powerful but also unwieldy and unattractive. By way of contrast to Daniel Friedman above, Larry Wall, the creator of Perl, criticized the highly cerebral Lisp attitude toward programming with the words

"By policy, LISP has never really catered to mere mortals.
And, of course, mere mortals have never really forgiven LISP for not catering to them."

The joke is that the Creator, like many software developers, was a bit rushed and chose to quickly throw together a working prototype rather than do the job right from the beginning; concurrently, that Cueball, thinking he has discovered an amazing and beautiful secret in the hidden world of Lisp, learns that in fact the real world is filled with ugly hacks and quick-and-dirty imperative code.

A (possible) hidden joke might be an oblique reference to Greenspun's tenth rule when God replies with "I mean, ostensibly, yes." Greenspun's tenth rule says that any sufficiently complex program written in another high level programming language will necessarily contain an imperfect, undocumented, slow, and bug-ridden implementation of about half of Common Lisp. Greenspun's tenth rule was meant to express the belief that Common Lisp, a large, full-featured Lisp dialect, is so flexible and robust that any attempt to render any really sophisticated program in most other languages requires the programmer to expend extraordinary effort unwittingly reinventing, in needlessly convoluted fashion, features and systems that would be elegant and trivial in Common Lisp. This explains why such a program might look or feel "Lispy" to an unfamiliar observer, and why the universe (if viewed as such a program) might look to mathematicians and scientists as though it probably has a beautifully simple mathematical basis, even if in reality it was just hacked together with a bunch of ersatz, special-case rules.

The title text continues the analogy by suggesting that the theory of quantum mechanics was written in regular expressions ("regexes"), a complex language for pattern matching used heavily in Perl. Regular expressions are often criticized as being a write-only language, that is, a language so complicated in syntax that any significant program written in them cannot be understood by anybody (often not even the original author). Documentation is essential to assist in the understanding of complex regular expressions. The title text claims that at some point, the documentation for quantum mechanics was lost, which explains why quantum mechanics is so bizarre and counterintuitive.

Transcript[edit]

[Floating in space.]
Speaker: Last night I drifted off while reading a Lisp book.
Cueball: Huh?
Speaker: Suddenly, I was bathed in a suffusion of blue.
[Floating in space before a vast concept tree.]
Speaker: At once, just like they said, I felt a great enlightenment. I saw the naked structure of Lisp code unfold before me.
Cueball: My God
Cueball: It's full of 'car's
Speaker: The patterns and metapatterns danced. Syntax faded, and I swam in the purity of quantified conception. Of ideas manifest.
[Close-up of floating in space before part of a concept tree.]
Truly, this was the language from which the gods wrought the Universe.
[Floating in space with God appearing through a line of clouds.]
God: No, it's not.
Cueball: It's not?
God: I mean, ostensibly, yes. Honestly, we hacked most of it together with Perl.

Trivia[edit]

  • In his Google-speech, Randall said that he spent 3–4 hours on getting the blue shading just right.


comment.png add a comment! ⋅ comment.png add a topic (use sparingly)! ⋅ Icons-mini-action refresh blue.gif refresh comments!

Discussion

I reckon I disagree with this:

In the comic, Cueball marvels at the fundamental and complete nature of the language of creation that he sees in his dream, the ultimate low level language, before being told by God that the universe was mostly built using a high level programming language, perl.

But, despite its age, Lisp is also a high-level language and lispers probably spend more of their time dealing with higher-level abstractions than perlists.

What's causing the narrator's marvel in the comic is that Lisp has a very elegant (almost non-existent) syntax and the language has a very close relationship with the underlying syntactical structure of the program, and that thinking about it does tend to give suitably-minded hackers feelings of awe and reverence, once they grok it. Even Larry Wall, the creator of Perl, will readily concede that Lisp is beautiful.

Perl, on the other hand, has masses of totally unrelated syntactical bits and pieces drawn from almost everywhere (basic syntax from C, a bunch of environment variables from shell or awk, an inline documentation format, inline regular expressions, formats borrowed from Fortran, bolted-on pseudo-OO from god-knows-where, you name it), so the language, is huge, messy, non-orthogonal, and ugly - but it does have the advantage that if you need a small job done, you can usually get it done in perl rather fast, at the cost, perhaps, of maintainability for long-term or large projects.

So the narrator dreams that the entire universe was created using the cleanest, most elegant and beautiful computer language so far discovered, one which allows the user to create software in terms of high-level abstractions if he or she chooses to; but in reality, God tells him it was a quick-dirty hack-job done in the dirtiest, ugliest - but effective nonetheless - language around. -- ‎86.165.192.2 (talk) (please sign your comments with ~~~~)

I think that A) you've missed the point of that statement, and B) If you believe the explanation to be inaccurate or incomplete you are fully encouraged to edit it. Also, Perl is not the dirtiest, ugliest language around. There are innumerable contenders, but I'd say Brainfuck is definitely in the running, and I personally would say that Java is in there too. lcarsos_a (talk) 05:03, 26 January 2013 (UTC)
Perl isn't a bad language. The regular expressions that it offers are fantastic, and it's at least consistent. Java's a slow messy and vulnerability-ridden language, but I'd have to go with PHP for the most awful, broken and incomplete piece of crap you could possibly use. Literally has no redeeming features outside of momentum and inexplicably widespread support. Davidy22[talk] 05:44, 26 January 2013 (UTC)
I never said Perl was bad. I need to teach myself Perl. and that Regular Expressions as we know them today came from Perl, is evidence enough that Perl is a wonderful language. And, I'll agree with you that PHP is an ugly, ugly, disgusting piece of trash. As someone who's had to do OO-PHP, just don't, run far away. I did. I ran to Ruby on Rails, and my life, as a web developer, has been heavenly. lcarsos_a (talk) 07:03, 26 January 2013 (UTC)

Lisp, the "ultimate low level language"? Ok, whoever wrote that really does not know what he/she is talknig about.

One of the most valuable characteristics of Lisp is the fact that is can be used in functional paradigm. Perl can also be used that way, but is considered a more hackish language and not as elegant as Lisp. Perl language can solve problems with different methods, and the phrase "ostensibly, yes. Honestly, we hacked most of it together with perl" means that the universe was created with perl, but trying to use Lisp way of programing (probably functional paradigm), instead of actually doing it on Lisp (probably for speed)

Oh, in case is not clear to somebody, Lisp is a HIGH LEVEL LANGUAGE.

Java and php would have to compete for the title of the "the dirtiest, ugliest - but effective nonetheless - language around" 189.135.124.172 18:32, 18 April 2013 (UTC)


Ok, somewhat a Perl-head here, but not going to add to the arguments about that. Instead: I think "My God, it's full of stars!" is not a quote from 2001 (where I'm fairly sure there's no broadcast dialoguge at all after Hal is silenced), but from the sequal, 2010, in the part where they 'review' the final recordings of the 2001 mission. But I really need someone who has these two films at hand to check before amending the explanation.

(Oh, go on then. Can I nominate Ada as the most godawful 'proper' language? Not as awkward as COBOL can be (for a proper programmer who doesn't need the "Business Orientated" tendencies), but has just the right (or wrong) mix of strictness to get my back up even while maintaining a pretence of being readable. Mind you, it's 20 years since I've used it, so memories about it may be distorted or outdated.) 178.98.31.27 21:50, 21 June 2013 (UTC)

Java is much more elegant and far less hacky than C++, and it's much faster than some people like to admit. It amazes me how many people complain about how "slow" it is, but have nothing but praise for languages like Python. Of course, C++ is much easier to optimize where time is critical. </minirant> 72.9.93.56 13:59, 3 August 2013 (UTC)

There is a direct reference to the "Lisp epiphany" that many non-LISP programmers are said to experience upon realizing how heavily influenced LISP was by mathematical logic. This is explained far better in a later explanation. It could be brought in here. --Quicksilver (talk) 03:37, 24 August 2013 (UTC)


I don't know whether it's important or not, but the line "My God, it's full of stars!" is the title of a chapter in The Little Schemer, which is considered (IMO) a classic CompSci book. If Randall has, by chance, read the book he may have also pulled the inspiration from there as well as 2001. I don't know whetiher this warrents a trivia block or not. 67.176.146.186 06:34, 27 October 2013 (UTC)

the quote comes from the book, not the movie. 173.245.53.129 (talk) (please sign your comments with ~~~~)

Lisp is the best language, unfortunately it's not that widely used.

Lisp is a high and low level language.

The worst programming language ever has to be Kodu game lab. Or possibly Malbodge. 141.101.98.244 (talk) (please sign your comments with ~~~~)

Perl is the language designed for the convenience of use. It mimics the natural language in the sense that it has great many slightly different features but each feature makes the most sense for its intended use and allows to write the easily understandable programs. An example of opposite is Pascal, which is a tiny language (i.e. "elegant" in the terms of its creator) but you can't do may things with it at all, and for what you can do, you have to turn yourself inside out. Lisp started in 1950s kind of like Pascal but then collected great many different features over time, each one to fix some of its inborn limitations. You still have to turn yourself inside out when you write in Lisp but nowadays there are great many ways to do so. If you wonder, Pascal had been extended as well, and Delphi is an example of an overgrown Pascal. 108.162.246.5 21:56, 29 January 2014 (UTC)

About the 2001 quote... I have the October 1968 Arrow paperback edition (09 001530 4) by A.C.Clarke and on page 221 Dave Bowman remarks "The thing's hollow - it goes on for ever - and - oh my God - it's full of stars!". So yes, in the movie this line was never used but in Clarke's novelization of his and Kubrick's screenplay it's there. Fast forward to 1984 with the release of 2010 and the filmmakers decided to put this soundbite in the intro to good effect. So yes it was never in the 2001 movie and was in the 2010 movie but as aforementioned, it was in the 2001 book. Squirreltape (talk) 20:18, 25 February 2014 (UTC)


I believe that the "ostensibly, yes" refers to Greenspun's tenth rule so I added this to the explanation. A complete set of rules for the universe is complex enough for the rule to apply. Meneldal (talk) 04:52, 11 March 2015 (UTC)meneldal


Remeber, one day we must all go through those Perly gates. 173.245.54.254 16:25, 9 June 2016 (UTC)

On the subject of the Universe's implementation language: http://www.songworm.com/lyrics/songworm-parody/EternalFlame.html Chrullrich (talk) 15:30, 26 February 2018 (UTC)

Does anyone think this could be related? https://goblinrefuge.com/mediagoblin/u/emacsomancer/m/my-god-it-s-full-of-car-s-png/ 172.69.42.45 02:34, 14 September 2020 (UTC)