@baibhavbista I'm adding ready to be used configs to this repo: https://github.com/babashka/sci-configs#funcoolpromesa So all you have to do is include that project and then use the config.
Thanks, fixed
thenks @borkdude 😄
btw there seems to be a typo.. the namespace is reagent for the js-interop one too 😅
How do I get macros from other namespaces working in sci in cljs? I found the following script to copy a namespace to sci https://github.com/babashka/sci#copy-a-namespace
(reduce (fn [ns-map [var-name var]]
(let [m (meta var)
no-doc (:no-doc m)
doc (:doc m)
arglists (:arglists m)]
(if no-doc ns-map
(assoc ns-map var-name
(sci/new-var (symbol var-name) @var
(cond-> {:ns fns
:name (:name m)}
(:macro m) (assoc :macro true)
doc (assoc :doc doc)
arglists (assoc :arglists arglists)))))))
{}
(ns-publics 'foobar))
The bit with (:macro/m) makes me think that it should transfer macros as well.
However, doing (ns-publics 'cljs.core.async) does not seem to return the macros like go, go-loop. Am I missing something?Ohh okay
majority of promesa's stuff (like the let) is also implemented as macros, no?
Not the majority, but quite a few: https://github.com/babashka/nbb/blob/main/src/nbb/promesa.cljs
ohhh you have to write kind of a wrapper macro to get it to work?
However, you have already done the work for almost everything I would want...I can just copy your code. Thanks a ton @borkdude !!
Yeah please go ahead and copy it :)
It works great, thank you 😁
I'm on org.babashka/sci {:mvn/version "0.2.8"}
I'm trying to get cljs.core.async and cljs.core.async.interop to work on sci. Is that possible?
core.async doesn't even work in self-hosted CLJS.
I recommend using promesa for async programming in CLJS. See #nbb which has a config for that.
In general, you can include a macro like this:
(defn ^:macro foo [_ _] `(do (+ 1 2 3)))
(def sci-ns (sci/create-ns 'foobar))
{'foo (sci/copy-var foo sci-ns)}Usually you have to re-implement the macro to be available in CLJS at runtime as a function, like that.