Fork me on GitHub
#clojurescript
<
2021-06-21
>
bortexz13:06:58

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?

bortexz15:06:04

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

tugh13:06:33

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

thheller13:06:55

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

🙂 6
Alex Miller (Clojure team)13:06:07

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

p-himik13:06:20

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

tugh13:06:49

thanks for the answers!

West14:06:41

Ummm? Wtf?

Derek14:06:26

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

Derek14:06:42

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

West14:06:24

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

West14:06:24

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

West14:06:45

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

Derek14:06:31

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

👍 3
thheller14:06:28

(or use a set if order is not important)

👍 6
☝️ 6
Jakub Šťastný21:06:55

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

borkdude22:06:57

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

Jakub Šťastný22:06:34

@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; <p className={styles.showcase}>...</p>, 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.

martinklepsch13:06:58

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