Fork me on GitHub

Using core.async, would it be better to return a channel from a function or pass one in?


If passed in the caller has more control, they can put transducers on the channel or close it whenever.


return by default, optionally pass in, here is an example from a recent cognitect lib:


Is this expected under Clojurescript?

(map int "abcde")
;; => (0 0 0 0 0)


It returns the ascii-codes in clojure (97 98 99 100 101). Weird.


i thought i had seen a bug somewhere in Jira/CLJS


Vote if you care about this 🙂


there is a patch proposed as well 🙂


cljs dont have char type I have a branch with a (deftype Character [c]) but there is a lot of problems with cljs implementations (for example, cljs.pprint) that expect the return of (first string) to be a string


Yeah, there is likely a lot of code in the wild too. My suspicion is that this can't be done as a non-breaking change.

👍 4

Excuse me, I am currently learning making PWA using reagent, but I have a trouble when checking the service worker. How do I convert (javascript) if ('serviceWorker' in navigator){} into Clojurescript? I tried using (when (in 'serviceWorker' js/navigator)) but it throws error that in is not avaiable


(when (contains? js/navigator "serviceWorker") ...)


It works but it returns wrong value It should returns true (I tested in Chrome)


You can do (.-serviceWorker js/navigator) - it'll be nil in browsers without that feature


Is deftype portable Clojure, especially when using mutability?


deftype in ClojureScript works essentially like it does in Clojure. In particular ^:mutable is supported on fields.

Logan Powell14:12:26

👋 Hi everyone! Is there something I need to be aware of in terms of keeping a function alive across calls in JS land? In this example, I'm trying to cache the last value, which works when I'm in the REPL/development, but when I release compiled js (on NPM) and import it, it never hits the cache...

Logan Powell14:12:35

This is just a toy example... I have to coordinate API calls across multiple APIs in a specific order


Anyone know of any open source Clojurescript + Reagent projects that make for good studying? I'm specifically trying to find a few larger(ish) projects which use core.async that I could dig into and learn from.


not Reagent but om: Circleci's frontend: Might make a good study for general clojurescript architecture


Awesome. Looking into it now! Thanks for the tip!


also, this search might help you to find more of them:;s=stars seems it's mostly libraries though, but LightTable/LightTable seems application-ish enough to qualify as well


That github query was where I started the hunt before coming to bug you guys on here ^_^ It def skews a little more towards the library side of things. I've tried narrowing it down a little more with core.async + reagent keywords, but... then all the results disappeared