Jay McCarthy's efficient implementation of Forth in 85 lines of Racket is beautiful. It demonstrates how you can integrate two different programming paradigms in one environment, and it does so with some impressive macro-fu. Consider his goals:
- We must be able to define functions in Forth that are callable from Forth, always.
- We must be able to give functions stack effect annotations to enable them to be called from Racket.
- We must be able to lift Racket functions to Forth so they are oblivious to the stack, like turning + into :+.
- We must be able to lower Racket functions to Forth so they can directly affect the stack, like writing :over.
- We must be able to enter Forth from Racket arbitrarily, such as to write testing forms like check-forth.
Meeting all those goals is an impressive feat.
As a functional tool, I'm not sure I see much of a use for it (yet). As a novel case study and series of examples, it's fantastic.