Fork me on GitHub
#nbb
<
2022-12-20
>
David Yang03:12:11

I’m trying to use clojure.core.match in nbb - is that possible? It looks like @borkdude added it to Babashka at some point but not sure if that means it gets into SCI or just impl’d at the Babashka level. I added it to my deps.edn and see that it’s downloaded but I get `Message: Could not find namespace: clojure.core.match Could not find namespace: clojure.core.match` when I try to require it

borkdude10:12:35

The clojure.core.match namespace for CLJS is exposed as cljs.core.match but this dependency relies on macros being loaded in a JVM (`.clj` extentensions) so you can't run it from source in nbb right now

borkdude14:12:20

Published a new version of nbb with upgraded SCI which has interop improvements. Here we're comparing clojure.math/sin called in SCI 1M times vs the interop version:

user=> (require '[clojure.math :as math])
nil
user=> (time (dotimes [i 1000000] (math/sin 1)))
"Elapsed time: 155.598000 msecs"
nil
user=> (time (dotimes [i 1000000] (Math/sin 1)))
"Elapsed time: 148.164333 msecs"
nil
Previous version:
user=>  (time (dotimes [i 1000000] (Math/sin 1)))
"Elapsed time: 592.297750 msecs"
nil
user=>  (time (dotimes [i 1000000] (math/sin 1)))
"Elapsed time: 150.626542 msecs"
nil

🎉 3
🚀 3
gotta_go_fast 4