This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-21
Channels
- # aws (3)
- # beginners (98)
- # boot (18)
- # cider (6)
- # cljsrn (8)
- # clojure (56)
- # clojure-dev (11)
- # clojure-spec (3)
- # clojure-turkiye (1)
- # clojurescript (34)
- # core-async (42)
- # cursive (8)
- # datascript (79)
- # defnpodcast (2)
- # dirac (13)
- # emacs (14)
- # jobs-discuss (3)
- # onyx (27)
- # overtone (1)
- # pedestal (1)
- # protorepl (1)
- # re-frame (40)
- # reagent (5)
- # unrepl (29)
- # vim (3)
How does one unload a node module in ClojureScript? It boils down to: How do I call:
delete require.cache[name];
Where name
is the fully resolved path to the module I want to unload.I got the (aget node/require "cache" name)
part working. But neigher (node/delete …)
nor (js/delete ...)
work.
@bobcalco I don’t know any way to do it other than:
(js* "delete ~{}" (goog.object/get js/require.cache name))
oh actually, there’s js-delete
(js-delete js/require.cache name)
should work
https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/core.cljc#L899
Thanks also for the reference @anmonteiro !
What is the cljs way of creating ES6 classes?
e.g. class Something extends React.component {
My understanding is that it isn't possible.
https://github.com/thheller/shadow/blob/master/src/main/shadow/react/component.cljs#L368-L405
create a constructor function like component-fn
, call (js/React.Component.call this ...)
Thanks!
not the target audience, but maybe you folks will like it. https://www.youtube.com/watch?v=BLDX5Twt2zk
greetings!
starting from how many, say, conj
es it will make sense to wrap vector in transient
? (let's say in a web or mobile app context)
10? 1000?
(let [f #(->> % (reduce conj []))
t #(->> % (reduce conj! (transient [])) (persistent!))
L 10
v (vec (range L))]
(time (dotimes [_ 1000] (f v)))
(time (dotimes [_ 1000] (t v))))
"Elapsed time: 2.158171 msecs"
"Elapsed time: 1.594682 msecs"
L 20
"Elapsed time: 9.934248 msecs"
"Elapsed time: 3.654435 msecs"
L 30
"Elapsed time: 16.031698 msecs"
"Elapsed time: 3.905617 msecs"
L 40
"Elapsed time: 15.380363 msecs"
"Elapsed time: 2.552671 msecs"
L 50
"Elapsed time: 26.149719 msecs"
"Elapsed time: 8.002839 msecs"
@U051HUZLD I’m not sure I understand the question really. I wouldn’t use transient unless benchmarking showed some benefit.
I thought there might be some basic rule of thumb, similar to "don't use datomic, if you will need 100b datoms within a year". My use case is in a function, which will deal with seqs of varying size of ~1-100. Was wondering if it even matters at such sizes (given, say few years old android device as an execution env,)
oh, I think I found my answer