This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-11
Channels
- # babashka (3)
- # beginners (70)
- # calva (15)
- # cider (34)
- # clara (10)
- # cljsrn (2)
- # clojure (28)
- # clojure-europe (21)
- # clojure-france (1)
- # clojure-uk (17)
- # clojuredesign-podcast (4)
- # clojurescript (51)
- # cursive (21)
- # data-science (1)
- # datalog (2)
- # datascript (2)
- # datomic (10)
- # emacs (5)
- # esprit (24)
- # expound (9)
- # figwheel-main (15)
- # fulcro (31)
- # graphql (3)
- # jobs-discuss (27)
- # keechma (2)
- # luminus (2)
- # malli (2)
- # minimallist (14)
- # nrepl (1)
- # off-topic (4)
- # pathom (1)
- # pedestal (8)
- # re-frame (10)
- # reagent (5)
- # reitit (2)
- # rewrite-clj (54)
- # sci (1)
- # shadow-cljs (34)
- # spacemacs (12)
- # sql (17)
- # vim (16)
- # web-security (1)
Has the quick-start page changed? I thought it included stuff about doing “manual” builds through the cljs.build
api?
I know it’s the case in Clojure, but in CLJS is there a performance benefit to using protocols over multimethods for simple type-based polymorphism? I get that protocols would probably be more idiomatic in this case regardless, just curious about the implementation.
how do i capture a required value in clojurescript? something like the following:
import EthCrypto from 'eth-crypto';
const EthCrypto = require('eth-crypto');
Hello! what is the analogy of this import AdyenDropIn from 'react-native-adyen-drop-in'
to Clojurescript ?
@stebokas (:require ["react-native-adyen-drop-in" :default AdyenDropIn]) in shadow-cljs
note that in the next release there will be a portable way to do that and a few other things
Hi,
I am using lein-figwheel
and I am trying to require a js libray. When I do I get the following error:
cljs.user=> (require '[aws-amplify :as aws])
ERROR: JSC_LANGUAGE_FEATURE. This language feature is only supported for ECMASCRIPT8 mode or better: async function. at /home/gomotso/navigare/navigator/node_modules/idb/build/esm/index.js line 63 : 19
ERROR: JSC_LANGUAGE_FEATURE. This language feature is only supported for ECMASCRIPT8 mode or better: async function. at /home/gomotso/navigare/navigator/node_modules/idb/build/esm/index.js line 71 : 12
ERROR: JSC_LANGUAGE_FEATURE. This language feature is only supported for ECMASCRIPT2018 mode or better: object literals with spread. at /home/gomotso/navigare/navigator/node_modules/idb/build/esm/index.js line 78 : 4
Can someone please help?I wrote up a tutorial on using AWS Amplify and Clojurescript a little while ago. Learnt a lot since then but I think its still useful https://dev.to/rberger/aws-amplify-and-clojurescript-re-frame-part-1-3d3f
the react components have changed since then, I had issues with @aws-amplify/ui-react
where your guide is using aws-amplify-react
forgot I'd put this together...the versions are probably out of date now, but basic repro here where the only difference is the version of the amplify components
Hey all! I'm working on porting a physics engine from clojure to clj: https://github.com/littleredcomputer/sicmutils, and was wondering if anyone had any suggestions for a possible way to add (and customize) ratio literal handling to cljs?
The goal would be to re-map a ratio literal to a https://github.com/infusion/Fraction.js object... I know that I can make my own tagged literal,
and have it work in both clj and cljs. But maybe there's some in-browser repl environment someone's seen that pre-processes ratios
That’s the memoize
function yea. I’m looking for a cljs compatible implementation of this lib: https://github.com/clojure/core.memoize
ah! got it, sorry about that
Is it possible to swap out the version of google closure library used by ClojureScript for a specific project vs. the default one used bu CLJS? Not for production, just curious.
Can we do this through deps.edn
or is the process a little more involved?
you can use an alias with :override-deps to do this in deps.edn
Oh nice, I think I was overthinking how google-closure-library is usually consumed by a JS app. Cheers!
@dnolen Do ya’ll still use https://github.com/clojure/clojurescript/blob/master/script/closure-library-release/closure-library-release.sh to package the google closure library as a maven project? Or is there another common way to package that up?
Do you think this batching buffer will translate well to ClojureScript? https://github.com/gensym/core.async.batching/blob/master/src/org/gensym/core/async/batching.clj
any buffer that is unbounded seems suspect, https://github.com/gensym/core.async.batching/blob/master/src/org/gensym/core/async/batching.clj#L8
Easily fixable.
what's the batching buffer doing? is it just accumulating items into a single collection? if so, I think a transducer with the traditional buffers would probably be a better fit
I was thinking more about the constraints of ClojureScript since it is written for Clojure
Transducers add latency for sparse messages. The idea is to process a batch of messages in one go.
Rather than pick one off at a time.
the implementation uses a ref
, which doesn't exist in js land, but since js is single threaded, you could just replace the ref with an atom. I'm not sure that makes it a good idea
there's a transducer called partition-all
that effectively does the same thing. I haven't done any profiling, but I would guess that using the partition-all
transducer would perform as well or better
using take or a batching transducer would make it wait until n messages were available or a timeout before delivering them. (more latency). versus the message processor when it has control saying "give me everything you have right now (up to N)".
I would probably still put that logic on the "outside" of the buffer, but the implementation would depend on how you would handle overflow (ie. producers producing faster than consumers consume)
but to answer your original question, you could translate the clj version to cljs by simply replacing the ref
with an atom
> "give me everything you have right now (up to N)". this can be implemented using any channel/buffer combo with:
(loop [chunk []
n 5]
(if (pos? n)
(if-let [val (async/poll! ch)]
(recur (conj chunk val) (dec n))
chunk)
chunk))
doesn't each poll incur some rendezvous overhead?
Seems a workable solution, but a batch would be better.
Is why re-frame implements its own work queue. But I thought it would be better if I could make it work with core async. And found that batching buffer.
I probably wouldn't worry too much about the nitty gritty performance aspects and just use the solution that makes the most logical sense. you can get pretty far by just writing straightforward code, http://swannodette.github.io/2013/08/02/100000-processes/
At this point in my career, I try to align performance with the semantics of my problem where I can. Porting a batching buffer seems a small price to pay to get that alignment. And it beats writing my own queue processor (which was my initial instinct) as in re-frame.
Thank you for your help!
looks great! > In fact I'm a bit scared because it just worked the first time. :rolling_on_the_floor_laughing: