Why Racket? Why Lisp?

so-cal-schemer1 pts0 comments

Beautiful Racket: Why Racket? Why Lisp?

Thank you for your comment

Beau­tiful Racket / appendix<br>Why Racket? Why Lisp?

Beau­tiful Racket and Prac­tical Typog­raphy were made possible by a publishing system called Pollen. I created Pollen with the Racket program­ming language. Racket is a descen­dant of Scheme, which in turn is a descen­dant of Lisp.

So while Racket is not Lisp (in the specific Common Lisp sense), it is a Lisp (in the familial sense). Its core ideas—and core virtues—are shared with Lisp. So talking about Racket means talking about Lisp.

In prac­tical program­ming projects, Lisps are rare. Racket espe­cially so. Thus, before I orig­i­nally embarked on my Lisp adven­ture, I wanted to under­stand the costs & bene­fits of using a Lisp. Why do Lisps have such a great repu­ta­tion, yet few users? Was I seeing some­thing everyone else missed? Or did they know some­thing I didn’t? To find out, I read what­ever I could find about Lisps, including Paul Graham’s Hackers & Painters and Peter Seibel’s Prac­tical Common Lisp. (OK, parts. It’s a big book.)

What I found was plenty of Lisp flat­tery from expert Lisp program­mers. (Also plenty of Lisp kvetchery from its detrac­tors.) What I didn’t find were simple, persua­sive argu­ments in its favor. So here’s why Racket was the right tool for me, and what I see as the prac­tical virtues of Lisps in general.

Consider the source

I didn’t study computer science in college (though I was a math major for two years, before switching to design). I’ve never held an offi­cial job as a programmer. Rather, program­ming has been a secondary skill I’ve used in my work as a web designer, type designer, and writer.

But in the last few years, I’ve spent an increasing amount of my time program­ming. This program­ming gener­ates income. So by the simplest defi­n­i­tion—does the skill make you money?—I suppose I qualify as a profes­sional programmer. And since most of my program­ming efforts are in Racket, I qualify as a profes­sional Racket programmer.

Mind you, I’m not claiming that I’m an expert programmer. Among the Racket commu­nity, which is laden with computer-science PhDs & profes­sors, I (have no choice but to) embrace my rela­tive inex­pe­ri­ence. Hence the title of my talk at Rack­etCon 2014: Like a Blind Squirrel in a Ferrari.

Yet despite my limi­ta­tions as a programmer, with Racket I’ve been able to render bigger ideas into programs more quickly, and with fewer bugs, than any language I’ve used before (and there have been many—BASIC, C, C++, Perl, Java, JavaScript, Python, and others). Since I haven’t gotten a brain trans­plant recently, there must be some­thing special about Racket as a language.

If you’re not familiar with Lisp

Lisp is a language most program­mers have heard of, for two reasons. First, it’s one of the oldest computer languages, in use since 1958. Second, it’s accrued a repu­ta­tion as a language for brainiacs. Orig­i­nally this repu­ta­tion arose from its asso­ci­a­tion with the field of arti­fi­cial intel­li­gence. Since then, this repu­ta­tion has been main­tained by peri­odic endorse­ments from respected program­mers (latterly, Eric Raymond and Paul Graham) and the enduring fame of the text­book used in intro­duc­tory computer-science courses at MIT, Struc­ture and Inter­pre­ta­tion of Computer Programs (which uses Scheme, and that one I did read start to finish).

But as main­stream program­ming tools, Lisp and its descen­dants have been largely ignored. Popu­larity of program­ming languages is tricky to measure, but here’s a simple proxy—let’s count the number of projects currently hosted on GitHub. One could quibble about the accu­racy of this method, except that the results aren’t even close:

LanguageGitHub projectsJavaScript7,488,087Java6,570,575Python4,017,958PHP2,123,489Ruby1,699,590Clojure64,239Lisp17,989Scheme12,412Racket11,725

The last four languages are Lisps, and together account for only 106,365 projects. Racket itself only accounts for a small frac­tion of this small frac­tion.

Popular program­ming languages aren’t neces­sarily good—look what’s at the top of that list.  + [JavaScript] has a lot of stupid in it … The good parts of [JavaScript] go back to Scheme and Self.<br>—Brendan Eich, here and here But unpop­ular languages often have fatal flaws that prevent wider adop­tion. As I was consid­ering languages, Racket had a lot to recom­mend it. But was there a fatal flaw I was over­looking? And by commit­ting to a Lisp, would I be painting myself into a corner? I wanted to under­stand the risks and bene­fits.

Flat­tery gets you nowhere

I said above that Lisp flat­tery is easy to find. The problem with Lisp flat­tery is that it makes sense only to expe­ri­enced Lisp program­mers. To others—espe­cially those who are trying to decide whether to learn and use a Lisp—it just comes across as unsub­stan­ti­ated hoodoo.

For example, in his essay How to Become a Hacker, Eric Raymond says “Lisp is worth learning for …...

lisp racket program tion ming languages

Related Articles