Skip to content

Instantly share code, notes, and snippets.

@mfikes
Created November 23, 2019 21:46
Show Gist options
  • Save mfikes/8852862755ec7dd2e95b2144360e8fb1 to your computer and use it in GitHub Desktop.
Save mfikes/8852862755ec7dd2e95b2144360e8fb1 to your computer and use it in GitHub Desktop.
Running ClojureScript on Espruino

With src/foo/core.cljs:

(ns foo.core)

(defn calculate []
 (let [xform (comp (map inc) (filter odd?) (take 123))]
   (transduce xform + (iterate inc 0))))

(js/print (calculate))

Then

clj -m cljs.main -O advanced -c foo.core

Then with espruino interpreter on your path:

$ espruino out/main.js

 ____                 _
|  __|___ ___ ___ _ _|_|___ ___
|  __|_ -| . |  _| | | |   | . |
|____|___|  _|_| |___|_|_|_|___|
         |_| espruino.com
 1v99.3983 (c) 2018 G.Williams

Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate

15129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment