Fork me on GitHub
#clojurescript
<
2019-04-26
>
Roberto Rodriguez Jr08:04:42

looking to make friends

Roberto Rodriguez Jr08:04:49

want to make mobile game, simple incremental model

misha08:04:43

what is the fastest polymorphic dispatch for a closed system in clojurescript? case?

orestis09:04:25

Case is supposed to be the fastest because it works on literals, but I think for more general approach, records which natively extend protocols will be the fastest choice.

metehan09:04:26

i ahve a problem

metehan09:04:30

<button onclick="threedays.core.add_cards(5)">ADD ITEMS</button>

metehan09:04:01

this doesn't work but when i write threedays.core.add_cards(5) on browser console it works

metehan09:04:26

(defn ^:export add-cards [amount] (for [x (range amount)] (add-card (+ x (count @state/cards)))))

metehan09:04:55

why button call doesn't work while broser console works

thheller09:04:13

@m373h4n for produces a lazy seq that the browser will not force. if you use something like cljs-devtools that will eval the full lazy seq when you "log" it to the console. You probably want to switch the for with doseq

metehan09:04:09

yes it worked thank you 🙂

misha10:04:43

@orestis I tend to shy away from records because they don't play with spec very well, but good to know, thank you

orestis10:04:08

Oh, this is Clojurescript - never mind my record advice in any case, I’ve no idea if this maps well to ClojureScript or not.

opieop 4
David Pham18:04:19

@dnolen thanks a lot for your tips about memory leak. In the end, it was a plug in from Firefox from my company and not my app that was leaking...

misha20:04:41

is it better (faster) to define multiple arities for a library function than vararg + apply inside of it? function is similar to cljs.core/update

dominicm07:04:25

Benchmark your case :)

kappa 4
dominicm07:04:41

But that's generally the argument given for core functions being defined like that.