Thursday, September 10th, 2015

Enjoy the Racket

racket, programming

Schemes are often regarded as not being practical languages due to their minimal implementations and perceived use purely for teaching. I’m guilty of buying into that perception too. Or I was when I first looked at Racket.

I took a look at Racket a number of times before giving it a real chance. Firing up DrRacket it’s easy to dismiss Racket as a teaching language with references to teachpacks, etc.

One thing that did pique my interest was Typed Racket. Those who follow this blog (or the previous incarnation at the now-defunct know that I’ve looked at Shen a lot in the past. The cool things about Shen are the type system and pattern matching that you don’t normally see in a lisp. Having played around with OCaml I know the power of a language with a strong type system: the benefit of the type system helping you write correct code outweighs the odd issue with satisifying the type checker. Shen however suffers from a rather complicated type system, one that is itself programmable, and is so free-form that the type errors don’t necessarily help.

This is where Typed Racket comes in. You get all the lisp goodness (REPL, macros, etc.) and an ML-like type system.

Moreover, Racket is a batteries-included lisp. You’re not typically going to find yourself reïnventing the proverbial wheel for some operation on lists, say.

And that’s when I understood the name change from PLT Scheme to Racket. Racket isn’t a scheme in the traditional sense alluded to in the opening paragraph. It’s a practical batteries-included lisp on par with Common Lisp (and surpassing it in many ways in my opinion). There are killer apps written in Racket and it’s encouraging to see John Carmack using it.

One of the cool things about Racket is the built-in GUI system; something that Common Lisp struggles with (though I do have high hopes for Qt with Clasp!).

Now for some fun: I threw together a wee implementation of Conway’s Game of Life in Racket.

Game of Life in Racket


comments powered by Disqus