Fork me on GitHub
Andrew Watts05:11:23

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.

Drew Verlee14:11:41

Does anyone want to work through 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?


Reader macros for CLJS have to return the code, similar to regular macros


They’re not very portable in that regard


Hello all. Given that

(into [] #{2 3 4})  => [4 3 2]
(apply (partial disj #{1 2 3 4}) [2 3 4])  => #{1}
(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

👍 3

i think you want #{ not #(

eccentric J23:11:42

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?

Jonathan Doane23:11:30

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

eccentric J00:11:54

Aye it’s static children. Thanks!


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))

👍 3