I'm going to cross-post this to #clojurescript, as I think it's an issue with the CLJS compiler, but I don't really know that for certain.
Does anyone want to work through https://www.youtube.com/playlist?list=PLdSfLyn35ej-n-SnvLkoTwdxhJWnfQ1QN Via a video meeting? Will just follow along and talk about choices, changes, etc...
I am trying to write a reader macro that will e.g. turn clojure.core/+ into clojure.core/- that works in for cljs. I was returning the clojure.core.Var for - which I now know will not work. What is the right way to do this? I had a solution working with calling eval in the macro but cljs doesn't have eval, right or am I off base there?
Hello all. Given that
(into [] #{2 3 4}) => [4 3 2]
and
(apply (partial disj #{1 2 3 4}) [2 3 4]) => #{1}
shouldn't
(apply (partial disj #{1 2 3 4}) (into [] #(2 3 4)))
also eval to #{1}
? I get an error, namely
#object[Error Error: function (){
return (2).call(null,(3),(4));
} is not ISeqable]
This seems to violate the transitive law of things evaling to things. Can anyone suggest a workaround?#(2 3 4)
is a weird function that isn't seqable
it's trying to call 2 on the args 3 and 4. and you're trying to get a seq of that which doesn't work for obvious reasons
i think you want #{
not #(
Reader macros for CLJS have to return the code, similar to regular macros
They’re not very portable in that regard
Is it possible to write a component in reagent that takes multiple children but doesn’t require a key on each child to render it?
use into
or statically place each child
;; static placement doesn't require keys
(defn my-component
[child1 child2]
[:div child1 child2])
;; dynamic number requires using `into`
(defn my-component
[& children]
(into [:div] children))
Dynamic children or static children? I’d argue that dynamic children should always have a key, otherwise you might be looking for something like this:
[:<>
[:span "a"]
[:span "b"]
[:span "c"]]
If you want
<span>a</span>
<span>b</span>
<span>c</span>