Skip to content

Instantly share code, notes, and snippets.

@mfikes

mfikes/yes.md

Created Nov 23, 2019
Embed
What would you like to do?
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