Paulo Suzart

Functional programming and a bit of a lot.

Why Racket is Awesome

**UPDATE: ** Just because I posted yesterday that Rust was a unstable with nightly releases, the guys just posted today (2015 April 3rd) the Beta release.

Finally 1st post of the year! Well, not that much to say lately. But here a piece of my sensations while playing with Racket last two weeks.

How I started looking at it

My first visit to Racket was possibly in the old times of version 4. But now with 6.1.1, the thing is such mature work.

Well, after a long time far from Clojure, at work we got some spare time so we could use it for tiny hackathons (a lot tiny BTW). We define silly scenarios where one could build using anything.

First I’d decided to go with OCaml, just to taste it. Sour! I mean, it is a good language but documentation is frustrating, libraries documentation even worse. Ok, so went for Rust, that is a good promise and should become one of my languages once it gets out of alpha stage: it is hard to compile libs with nightly builds, everything brakes, etc.

But Rust is being crafter along with solid libraries like Hyper. Man, this is great. But lets wait things mature a bit.

So, now what? Clojure? No. Racket!

If I was a language creator/contributor I would feel ashamed with this brilliant documentation since I couldn’t produce such quality writings. Period.

Just take a look at http://docs.racket-lang.org/. See? You just want to start coding right now.

What I’ve found

Of course, good languages has more than good documentation. My experiments covered Input/Output and Concurrency and Parallelism. And there couldn’t exist more concise concepts and API.

Threads are light and also got Mailboxes, IO got Events.

Command args line handling? No lib, just use Racket like in this small example.

You also have raco and DrRacket, a complete editor that shows you arrows pointing from which module functions come from, also the uses of a function in your code and a Graphical Debug Interface and much more. This is not a complete overview of this language (I have no nuts to do such thing).

Another good thing is that Racket doesn’t need a huge decision table to make you pick you the right construct for holding data (struct, deftype, recors, etc, etc, etc). This is straightforward and pragmatic. Use structs, be happy.

When it comes to performance, Java and Clojure win. I don’t really know how much effort Racket guys put on this. And for lots of scenarios it makes no difference.

Have I told you Racket can also produce beatyful desktop apps? Take a look here.

What now?

Ok, I’ll definitely try to have more Racket in my life. It brought me back the charm of LISP. I read Land of LISP few years ago, now it may be time to read Realm of Racket

This post is not teaching you anything but shares my findings so far. If you want to see some code you can access this currency-watcher.rkt that is silly program to query a currency conversion API and report to HipChat if things change a lot. And this second Gist shows a multi thread/serialization/socket playing with three .rkt files.

You can also follow their Youtube channel Racket Lang to find good videos.

Good Luck!

comments powered by Disqus