Playing Around With Racket

Sat, Jul 18, 2015 2-minute read

Lately I’ve been playing around with the racket dialect of lisp. Racket is a language of the scheme family, and so far I’ve found it simple enough to pick up through the provided tutorials. Things I like about it are

  1. Simple syntax. It is a lisp, after all, so there are plenty of parentheses. One thing racket does, however, is treat all brackets: (, [, and {, the same. As long as they are balanced by the appropriate closing bracket, they are interchangeable. This allows you to write programs that have a bit more variety than common lisp. e.g.
(let ([x 5] [y 6])
    (+ x y))
  1. It’s very extensible. Racket provides many ways to modify the surface syntax and add new language features. Some examples of how this feature has been put to use are: Racket ships with a strongly typed version of the language, called typed racket, and it can also be extended to support prolog-like clause definitions. The ability to mold the language into anything at all is very appealing to me, as domain-specific language development is a bit of a specialty of mine.

  2. It comes with batteries included. The base install has tons of useful libraries. In fact, one of the first tutorials I went through guided me in constructing a working HTTP server with very little effort.

So far I haven’t played with it enough to pick out any glaring flaws, but since all languages have them, I’m sure I’ll encounter them in due time. So far I’ve especially been blown away by typed racket: the fact that you can mold the language into a strongly typed dialect is beyond my comprehension. Coming from Haskell, the type system isn’t as robust, but it definitely a selling point: all the flexibility of a lisp, with strong typing.