heresy

Every so often, a fey mood takes me, and I write a program that probably shouldn't see the light of day. I've done so with a PLT package called infix. It's a package for writing infix expressions in PLT Scheme, but it does some other funky stuff. For example: ``


(module test mzscheme
 (require (planet "infix.ss" ("dyoo" "infix.plt" 1 0)))

 (infix printf("hello, this is a test: ~a ~a~n",
               list(3, 4),
               5))

 (define (in-order a b c)
   (infix printf("in-order(~a, ~a, ~a): ~a~n",
                 a, b, c, a <= b <= c)))      (infix in-order(1, 2, 3))   (infix in-order(1, 3, 2)))

I had a very good laugh with Guillaume when I showed this to him. You have to be a Schemer to appreciate how very wrong this is.

This technique is a proof-of-concept that shows just how programmable the PLT Scheme syntax system can be. It wouldn't be much more work to embed a different programming language syntax in here, as long as it's compatible with s-expressions. The source code for this can be found here.