clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
bertofer 2021-06-21T13:07:58.458100Z

Not sure if this question goes here or in core-async, as the question is related to the cljs implementation of core.async: As there is only one thread in cljs, is it guaranteed that consecutive put! will keep the order of calling on the elements of the channel? E.g. In hasslet, the websocket client, I feel this line could cause out of order messages in clojure due to the multiple threads https://github.com/weavejester/haslett/blob/master/src/haslett/client.cljs#L48 but maybe not in javascript? Or maybe in clojure either it wouldn’t cause out of order messages and I’m misunderstanding it?

tugh 2021-06-21T13:34:33.459100Z

do anyone know why (number? js/NaN) returns true? i'd expect otherwise

thheller 2021-06-21T13:35:55.459500Z

ask javascript. typeof(NaN) gives you "number"

🙂 2
alexmiller 2021-06-21T13:37:07.460Z

NaN is a valid IEEE 754 floating point number, just don't think about it too hard

p-himik 2021-06-21T13:38:20.461Z

It might also be a case of a mismatched name. Perhaps it would be better as "an undefined number".

tugh 2021-06-21T13:46:49.461400Z

thanks for the answers!

West 2021-06-21T14:42:41.461700Z

Ummm? Wtf?

Derek Passen 2021-06-21T14:43:26.462Z

You’re passing a single argument (a list) to distinct?

Derek Passen 2021-06-21T14:43:42.462500Z

try (distinct? 1 2 3) and (distinct? 1 2 3 2)

West 2021-06-21T14:45:24.463100Z

whew, lol ok I knew there was something weird going on

West 2021-06-21T14:47:24.463500Z

Damn, how might I work something like this then? (distinct? (conj (range 10) 1))

West 2021-06-21T14:47:45.463900Z

It returns true, but I want it to process each item separately.

Derek Passen 2021-06-21T14:48:31.464200Z

(apply distinct? (conj (range 10) 1))

👍 1
thheller 2021-06-21T14:50:28.464700Z

(or use a set if order is not important)

👍 2
☝️ 2
bertofer 2021-06-21T15:27:04.465400Z

Looking at <chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/http://cdn.cognitect.com/presentations/2014/insidechannels.pdf> it seems I completely misunderstood it, and pending puts do actually keep ordering, I was confused with spawning multiple go blocks

2021-06-21T21:36:55.467800Z

Would garden be the "default" way of writing CSS in CLJS? I see it being mentioned a lot.

borkdude 2021-06-21T22:11:57.468800Z

@jakub.stastny.pt_serv A lot of people just use whatever mainstream tool to write their CSS (less, sass, ...)

2021-06-21T22:16:34.474Z

@borkdude OK. I was using CSS modules in React. But I suppose that given the nature of garden, it has the CSS modules way of doing things included? By that I mean that there's no need to import styles from 'mystyles.css.modules; &lt;p className={styles.showcase}&gt;...&lt;/p&gt;, because Garden being data, you simply pass variables around and you never get into naming problems (such as renaming a CSS class), because either it works and the compiler is happy, or if there's naming problem in a variable, then the compiler complains, so it can never go missed? So CSS modules is not a thing in Garden, because it implicitly supersedes it.

martinklepsch 2021-06-22T13:29:58.478Z

There’s a few CSS-in-JS approaches for CLJS as well. I think the modules stuff generally requires build tool support, which you can set up but is annoying in my experience