Just Hack Something Together

September 04, 2014

Summary: Lisp is viewed as difficult and academic but it is a great language for hacking a solution together.

I used to be in a carpool with other developers. We would drive an hour to work each way. And sometimes we'd talk about programming languages. Once I was talking about why Common Lisp wasn't more popular. Someone answered "people just want to hack something together".

That took a while to unpack and it felt like many conversations I had with that group. Without exploding all of the context, I'll just say that he meant that Common Lisp was less amenable to quickly building a solution than Java1. That notion caused my head to spin and I didn't know how to respond.

So I'll respond here, now (5 or 6 years later!). Lisp was made to explore solutions quickly. Lisp is often seen as a difficult, academic language. But Lisp has several things that make it a beautiful language for hacking a solution together.

1. The REPL

You can type code in and it will run. Right there. The entire language is available without having to open a text file. You can experiment on a solution, testing as you go. This is much faster than having to write a main method.

2. Incremental compilation

You can redefine a function. Any code that calls that function will now use the new definition. You no longer have the edit-compile-run cycle. You can make changes and fixes much faster.

3. Data structures

Even the humble Lisp list is better than most of what Java gives you. Lists can represent linear data, trees, or associative data. But more importantly, the interface is powerful. There are many operations built to use lists, so you're compounding effectiveness on top of everything built in. And if you bring in Clojure's data structures, there's no comparison.

In Java, you can use Lists and Maps. But most of the time, people will create a new class to represent their data. And making a new class means you have to write all of the methods. And that is definitely slower than using an existing data structure with existing methods.

4. Less code

Lisp is less verbose than Java. If you're trying to go quickly, one limiting factor is how fast you can type the code in.

I purposefully left out a lot of the features of Lisp that make it great because some of them are considered "advanced". I want to keep the list down to those basic things that you're going to have to use in order to use the language. The "advanced" features require expertise in order to be more efficient at them. You can be more effective in Lisp with a small cheatsheet of syntax and functions.

I think it's pretty clear that Lisp is superior to Java for "hacking". It was developed to experiment with programs interactively. And it serves that purpose very well. If you think you'd like to learn a modern Lisp, I suggest learning from LispCast Introduction to Clojure. It's a great video series that takes you from zero knowledge to a deep understanding of functional programming.

Learn Functional Programming using Clojure with screencasts, visual aids, and interactive exercises
Learn more

You might also like


  1. I don't mean to pick on Java, it was his language of choice. Having a comparison language merely helps the imagination

Pre-West Prep: Jeanine Adkisson

April 03, 2015

Talk: Design and Prototype a Language in Clojure

Jeanine Adkisson's talk at Clojure/West is about designing and prototyping a language using Clojure.

Background

Lisps have been used for a long time to prototype other languages. Scheme was designed and used for just that purpose. The most popular books on compiler design often start with Lex and Yacc, which are just really old tools built when memory was so restricted you had to do your parsing in stages. Instaparse is way better for quickly exploring syntax. And since lambda calculus (which Clojure is based on) is computationally complete, you're in good hands exploring the entire range of computational semantics.

However, these are just generalities. Jeanine Adkisson will likely bring wit and depth to the talk, as she did in her Clojure/conj talk. She's a language designer, so she's got plenty of experience to draw from.

As an interesting background to language prototyping in Clojure, check out Bodil Stokke talking about her language Bodol.

About Jeanine Adkisson

Homepage - GitHub - Twitter


This post is one of a series called Pre-West Prep, which is also published by email. It's all about getting ready for the upcoming Clojure/West, organized by Cognitect. Conferences are ongoing conversations and explorations. Speakers discuss trends, best practices, and the future by drawing on the rich context built up in past conferences and other media.

That rich context is what Pre-West Prep is about. I want to enhance everyone's experience at the conference by surfacing that context. With just a little homework, we can be better prepared to understand and enjoy the talks and the hallway conversations.

Clojure/West is a conference organized and hosted by Cognitect. This information is in no way official. It is not sponsored by nor affiliated with Clojure/West or Cognitect. It is simply me (and helpers) curating and organizing public information about the conference.

You might also like