The fastest Clojure REPL in the world – Lumo (by António Nuno Monteiro)
From its announcement
Lumo is a fast, standalone ClojureScript REPL that runs on Node.js and V8. Thanks to V8’s custom startup snapshots, Lumo starts up instantaneously, making it the fastest Clojure REPL in existence.
Ideally suited to be used instead of e.g. Bash or Perl, for scripts executed from the (Linux in my case) command prompt. Plus Lumo is multi platform!
Example (an HTTP server for IP logging)
#!/usr/bin/env lumo;; ;; Adapted from: https://mmcgrana.github.io/2011/09/clojurescript-nodejs.html ;; ;; Twitter: @maridonkers | Google+: +MariDonkers | GitHub: maridonkers ;; def http (js/require "http")) (def process (js/require "process")) ( defn handler [req res] (let [dt (.toISOString (js/Date.)) ( ip req.connection.remoteAddress]println (str dt " - " ip)) (200 (js-obj "Content-Type" "text/html")) (.writeHead res str "<!DOCTYPE html>" (.end res ("<html>" "<header><title>IP logger</title></header>" "<body><H1>" ip " was logged at " dt "</H1></body>" "</html>\n")))) let [host (nth (.-argv process) 3) (nth (.-argv process) 4) port ( server (.createServer http handler)] (.listen server port host)println (str "IP logging server running at http://" (":" port))) host
Make the file executable and execute with host and port parameters, e.g. as follows:
./http-ip-logger localhost 8000
And navigate to http://localhost:8000.