Replete: A Standalone iOS CLJS REPL

June 27, 2015

With the recent work to bootstrap ClojureScript, I've been thinking one cool use case is to have a standalone REPL that can run on devices: Oftentimes, especially when I was first learning Clojure, I would be mulling over some language feature. To confirm my thoughts I'd quickly hop on a REPL to see how things empirically behaved—unless I wasn't near a computer.

With an on-device REPL, that's not a problem if you carry a mobile device with you. Himera is great if you have a browser with connectivity, but I've always kind-of wanted a dedicated app that could just run by itself.




When David Nolen posted some sample code showing the bootstrapped analyzer and compiler working for the first time (evaluating the keyword :foo), I could see that this dream would soon become a reality. (I predicted we'd probably see this stuff generally available on devices in less than a year.)

A few years ago, Joel Martin presented a fork of the ClojureScript compiler self-hosting in the browser JavaScript environment: Introducing ClojureScript-in-ClojureScript. With the recent work to bootstrap the mainline ClojureScript compiler, Joel has started hacking on things again and got a REPL working in Node.

When I saw how small his read-eval-print-loop was, I knew it would be easy to put something like that in an iOS app with some UI layered on top of it. I've made a first attempt at it and it is actually working! A REPL on iOS. Here's a demo of it:

 




 

Lots of work still needs to be done, both in polishing the app to make it nice and usable, as well as in the ClojureScript bootstrapping effort itself. My plan is to get this app into shape and release it as a free app in the iOS App Store. In the meantime, if you are curious, you can check it out on GitHub here.

Tags: iOS ClojureScript Replete Bootstrap