This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-07
Channels
- # adventofcode (4)
- # aleph (1)
- # architecture (9)
- # beginners (67)
- # boot (7)
- # boot-dev (12)
- # cider (3)
- # clojure (166)
- # clojure-austin (3)
- # clojure-estonia (1)
- # clojure-greece (2)
- # clojure-russia (5)
- # clojure-spec (1)
- # clojure-uk (4)
- # clojurescript (19)
- # cursive (1)
- # data-science (5)
- # datascript (4)
- # datomic (3)
- # docs (10)
- # emacs (24)
- # events (4)
- # fulcro (16)
- # graphql (8)
- # hoplon (2)
- # jobs-discuss (1)
- # leiningen (5)
- # off-topic (2)
- # planck (30)
- # re-frame (20)
- # reagent (36)
- # ring (3)
- # shadow-cljs (5)
- # spacemacs (1)
- # specter (2)
(moving over question from #clojure) is there some restricted subset of cljs that can be used to write ultrafast wasm ?
@qqq there is a subset of ClojureScript which can be compiled into WASM, it is called Clojure š look into http://teavm.org, but Iām not sure if it can run ultrafast, I doubt it š
another option would be to use Ferret, https://ferret-lang.org and compile resulting C++ to WASM
AFAIK, WASM is designed as compilation target, it would be PITA to write anything directly in it (no matter of source code notation)
let NumClojure = NumPY rewritten in Clojure. I suspect it would be straight forward to write a NumClojure -> WASM compiler, reading in sexp and outputting sexp
But GC and native exception handling is on the roadmap so.... maybe it will be a suitable target for Clojure in the future?
Hey everyone, is there a recommended tool that can help me track down why my ClojureScript build (using lein-cljsbuild) with advanced optimizations is way bigger than it should be? Or are there know pitfalls?
my point (but never explicitly stated) is that if you're just doing tensor math, you don't need a gc
I don't know enough wasm, so I'm currently going the clojure dsl -> c -> llvm -> wasm route
@qqq the problem with CLJ -> wasm is the same with CLJ -> C . No GC, no polymorpism, no object system, etc.
@kenrestivo I am using cljs-http. I have no idea if that is current best practice, however.
@tbaldridge: sorry, by "CLJ -> wasm" I mean "some data struture in CLJ -> wasm", not "clj itself -> wasm"
@tbaldridge: in fact, here's what I have so far:
(do ;; expr->str
(def expr->str (let [f #(apply a/strf %1 (map expr->str %2))]
(fn [expr]
(a/ctl expr
[[::var ::vname] vname]
[[::arr ::base ::index] (f "(%s[%s])" [base index])]
[[::add ::lhs ::rhs] (f "(%s+%s)" [lhs rhs])]
[[::sub ::lhs ::rhs] (f "(%s-%s)" [lhs rhs])]
[[::mul ::lhs ::rhs] (f "(%s*%s)" [lhs rhs])]
[[::div ::lhs ::rhs] (f "(%s/%s)" [lhs rhs])]))))
(ct/is (= "a" (expr->str (var-raw {::vname "a"}))))
(ct/is (= "(a[b])" (expr->str (arr-raw {::base (var-raw {::vname "a"})
::index (var-raw {::vname "b"})}))))
(ct/is (= "(a+b)" (expr->str (add-raw {::lhs (var-raw {::vname "a"})
::rhs (var-raw {::vname "b"})}))))
(ct/is (= "(a-b)" (expr->str (sub-raw {::lhs (var-raw {::vname "a"})
::rhs (var-raw {::vname "b"})}))))
(ct/is (= "(a*b)" (expr->str (mul-raw {::lhs (var-raw {::vname "a"})
::rhs (var-raw {::vname "b"})}))))
(ct/is (= "(a/b)" (expr->str (div-raw {::lhs (var-raw {::vname "a"})
::rhs (var-raw {::vname "b"})})))))
it translates "clojure data" representing a C program into a string, which is corresponding C code; currently it only does exprs, no statements yet