This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-03
Channels
- # aleph (7)
- # announcements (6)
- # babashka (34)
- # beginners (5)
- # calva (1)
- # cider (3)
- # clerk (11)
- # clj-http (1)
- # clj-kondo (35)
- # clojars (6)
- # clojure (114)
- # clojure-australia (1)
- # clojure-brasil (2)
- # clojure-europe (73)
- # clojure-hamburg (3)
- # clojure-nl (1)
- # clojure-norway (27)
- # clojure-uk (4)
- # events (3)
- # graalvm (13)
- # gratitude (4)
- # helix (17)
- # hoplon (1)
- # hyperfiddle (65)
- # instaparse (4)
- # jobs-discuss (6)
- # lsp (2)
- # meander (2)
- # rdf (4)
- # re-frame (51)
- # reitit (28)
- # releases (1)
- # sci (20)
- # shadow-cljs (9)
- # tools-deps (4)
- # xtdb (44)
I am a bit confused on how I can use libraries in sci, I am embedding sci in a clojurescript app I am setting up sci with init to create a context, I want to be able to use reagent in the context which is already required outside sci, my understanding is I need to use :namespaces is this correct and can I just expose the entire library ? Or do I need to pull in reagent into sci seperately a bit like scittle does ? hoping someone can point me in the right direction.
@UU67HFS2X My recommendation for reagent is to use the config from here: https://github.com/babashka/sci.configs#reagentreagent
that's great that looks like the info I was missing thanks @U04V15CAJ
yeah handy I can look at the src and see how they are included now, I see sci/copy-var is the piece ~I likely needed but I can just pull in those configs in my deps now and save myself the trouble 🙂
great, I have managed to add in what I require and it works, I was hoping for honey but getting a sequential? does not exist so need to investigate that one but reitit seemed to work 🙂
(def rf-ns (sci/create-ns 'reitit.frontend nil))
(def rfe-ns (sci/create-ns 'reitit.frontend.easy nil))
(def rss-ns (sci/create-ns 'reitit.coercion.spec nil))
(def sql-ns (sci/create-ns 'honey.sql.core nil))
(def sqlh-ns (sci/create-ns 'honey.sql.helpers nil))
(def sci-ctx
(sci/init
{:namespaces
{'reagent sci-reagent/reagent-namespace
'sql {'format (sci/copy-var sql/format sqlh-ns)}
'sqlh {'select (sci/copy-var sqlh/select sqlh-ns)
'from (sci/copy-var sqlh/from sqlh-ns)
'where (sci/copy-var sqlh/where sqlh-ns)}
'rf {'router (sci/copy-var rf/router rf-ns)}
'rss {'coercion (sci/copy-var rss/coercion rss-ns)}
'rfe {'start! (sci/copy-var rfe/start! rfe-ns)
'href (sci/copy-var rfe/href rfe-ns)}}}))
currently got these added, nice work as usual I was using klipse before but that seems to not work with the latest clojurescripts so was curious if I could use this in its place 🙂$ clj -M:cljs -m cljs.main -re node
ClojureScript 1.11.54
cljs.user=> (require '[sci.core :as sci])
nil
cljs.user=> (sci/eval-string "sequential?")
#object[cljs$core$sequential_QMARK_]
give me a sec may be more info of the edge of the screen, only just encountered it as I included the library 🙂
btw I recommend using the full namespace names in :namespaces
. you can provide :aliases
for those namespaces as well
the sequential isses was happening inside some honey code but its not related to honey, just evaling sequential? like above is giving me this from sci
#error {:message "Could not resolve symbol: seqential?", :data {:type :sci/error, :line 9, :column 1, :file nil, :phase "analysis"}}