Here is a nice introduction to the inspiring parts of Racket and it’s culture (of Racketeers).
Here is a nice post about generic data types in Racket.
(require 'package) (when (not (package-installed-p 'geiser)) (url-copy-file "https://www.wisdomandwonder.com/wp-content/uploads/2012/09/geiser-0.2.1.tar" "/tmp/geiser-0.2.1.tar" t) (package-install-file "/tmp/geiser-0.2.1.tar"))
Understanding the Y-Combinator seems to be one of the functional programming right-of-passage things, and for good reason, it is fun. Not all of the articles out there spoke to me, so I took notes while coding it up in a way that I understood it.
My notes are attached in the form of a Scribble here How the Y Works, viewable here, and the source code version here y.
It is Racket, but it is really close to Scheme and if you wrote a couple of macros it would probably run on Clojure pretty easily.
The goal is for there to be no gaps in the code, it should be pretty obvious how each step was taken. Hand-coding it made it clear what was happening. This is what worked for me :).
Now the popularity of DSLs may have waned, but the fun surrounding them surely has not.
A while back James and I looked into implementing a DSL for modeling insurance products in Java that worked really nicely:
- built on top of Java we’ve full access to all its goodies like the libraries and object system and containers
- integrates with Eclipse to get code-completion and error-reporting and intelligent-debugging
- open-source so we can tweak and bug-fix as needed
If that is your cup of tea, you might have a look at this super awesome tutorial on implementing a brainf*ck interpreter on top of the Racket programming language:
Basically you get all the power of what Racket has to offer as a language, its libraries, it’s IDE, and the great users.
The article is sort of funny in that the first version of the DLS was deemed “too slow” at 37 second vs 16 second for the version running on the PyPy interpreter; so the author went about optimizing it with all sorts of tweaks that are might be inappropriate for an entry-level article, but for bragging rights… dropping its benchmark speed down to 1 second.
The scribble/srcdoc and scribble/extract libraries support writing documentation within the documentation code along with an export contract, similar to using JavaDoc.