clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
Andrew Watts 2020-11-12T05:14:23.147100Z

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.

2020-11-12T14:08:41.148100Z

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

escherize 2020-11-12T16:20:49.150500Z

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?

Jason 2020-11-12T17:02:24.155400Z

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?

dpsutton 2020-11-12T17:04:04.155700Z

#(2 3 4) is a weird function that isn't seqable

dpsutton 2020-11-12T17:04:48.156200Z

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

đź‘Ť 1
dpsutton 2020-11-12T17:05:05.156500Z

i think you want #{ not #(

lilactown 2020-11-12T17:06:20.157700Z

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

lilactown 2020-11-12T17:06:31.158200Z

They’re not very portable in that regard

2020-11-12T23:14:42.161200Z

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?

lilactown 2020-11-12T23:34:37.161400Z

use into

lilactown 2020-11-12T23:35:02.162100Z

or statically place each child

lilactown 2020-11-12T23:36:05.163500Z

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

đź‘Ť 1
Jonathan Doane 2020-11-12T23:47:30.163600Z

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>