Fork me on GitHub
#clojure
<
2019-01-20
>
whilo06:01:07

Is there a way to parametrize namespaces or dependencies? I am at the moment fiddeling around this to make code optionally core.async compatible, but leave it synchronous on the JVM.

seancorfield06:01:14

So cljs and clj do different things @whilo? That sounds like reader conditionals. https://clojure.org/guides/reader_conditionals

whilo07:01:13

I am heavily making use of reader conditionals, but this is about macro-expanding code differently depending on backend settings. Basically you can use core.async on both JVM and JS, but sync code on the JVM.

john19:01:10

There's a hacky way I parameterize namespaces in CLJS here: https://clojurians-log.clojureverse.org/cljs-dev/2019-01-08/1546981037.172600 It CLJ it might be a little more straightforward for namespaces, though not sure about the dependency part.

thomas15:01:23

Hi all.... I ama but stuck on this one...

thomas15:01:38

this works for me: (apply conj #{1 2 3} '(4 5 6 )) as expected...

thomas15:01:29

but when the set is in an atom I can't do this (swap! atom-with-a-set-in-it apply conj '(4 5 6))

thomas15:01:27

the I get an error: Wrong number of args (4) passed to: PersistentHashSet

opoku15:01:17

Try (swap! atom-with-a-set (partial apply conj) ‘(4 5 6))

thomas15:01:22

yes, that looks good... but why the partial as well?

opoku15:01:01

What you have ends up being (apply a-set conj '(4 5 6))

opoku15:01:22

(partial apply conj) returns a function that is is passed the set as its first parameter and your (4 5 6) as its second parameter

thomas15:01:59

makes sense. thank you @osei.poku