This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-14
Channels
- # atom-editor (5)
- # babashka (6)
- # beginners (29)
- # calva (16)
- # cider (1)
- # clj-kondo (20)
- # cljs-dev (44)
- # clojure (29)
- # clojure-europe (19)
- # clojure-nl (8)
- # clojure-norway (7)
- # clojure-spec (2)
- # clojure-sweden (1)
- # clojure-uk (56)
- # clojurescript (32)
- # code-reviews (30)
- # conjure (24)
- # cursive (49)
- # datomic (4)
- # fulcro (31)
- # helix (3)
- # instaparse (4)
- # kaocha (100)
- # lambdaisland (2)
- # mid-cities-meetup (1)
- # monads (1)
- # off-topic (42)
- # pathom (13)
- # pedestal (6)
- # portal (5)
- # re-frame (6)
- # reagent (9)
- # reitit (11)
- # remote-jobs (1)
- # rewrite-clj (11)
- # shadow-cljs (44)
- # sql (22)
- # tools-deps (13)
- # uncomplicate (1)
- # xtdb (15)
I'm trying to make our web app, which serves compiled ClojureScript, always serve the most up-to-date version, i.e. only use the browser-cached version if there is not a newer version on the server. Adding Cache-Control: no-cache
to the response headers and similar meta
tags on the HTML hasn't solved the problem. The index file we serve is up to date, but the CSS and compiled JS are not. can anyone advise?
the easiest way is to include the version in the js filename and just update the js <script>
src when the version changes.
hi, is it possible to use with-redefs
to redefine javascript functions, like say js/setTimeout
?
hmm, repl would seem to indicate 'yes':
cljs.user=> (with-redefs [js/setTimeout (constantly true)] (js/setTimeout :blah :blahzzz))
true
perhaps a more convincing example:
cljs.user=> (with-redefs [js/setTimeout (constantly :blaaaaaaz)] (js/setTimeout :blah :blahzzz))
:blaaaaaaz
Just wanted to show off some cljs on hardware. Pretty neat new use case for the lanugage https://youtu.be/WYSL-fD_ogA
do you have a link to where I could get the display you’re using? it looks nice. I have an idea for a project
They’re pretty cheap for what they are, but ofc you have to wait for the shipping from China.
My roomate and I are working on this, and we plan to sell a little kit with a PCB with the ESP32, some sensors, the VFD itself, and a nice case. I’ll keep everyone posted.
Hello guys. I try to write some recursive function, but I must mess up something with the logic. I wanted to printed it out, but it won't. Does (.log js/console "something")
work inside a reduce function?
hmm, for me it doesnt. If I print to console the data-structure which it resulted, it is okay. But if I want to see the parameters step-by-step, and I try to print them, it won't do it.
(defn make-some-true [the-map path]
(.log js/console "success-in2 ")
(let [result (doall (convert-indexed-map-to-vector
(reduce-kv (fn [till-now now-key now-value]
(if (= (first path) (:name now-value))
(if (not (empty? (rest path)))
(assoc-in
(assoc-in (assoc till-now now-key now-value)
[now-key :state] true)
[now-key :children]
(make-some-true
(:children now-value)
(rest path)))
(assoc-in (assoc till-now now-key now-value)
[now-key :state] true))
(assoc till-now now-key now-value)))
{}
the-map)))]
result))
(defn make-all-false [the-map]
(.log js/console "success-in")
(vec (reduce (fn [till-now now]
(conj till-now
(if (:children now)
(assoc now :state false :children (make-all-false (:children now)))
(assoc now :state false))))
[]
the-map)))
(defn assoc-with-values [the-map paths]
(.log js/console "success")
(vec (reduce
(fn [till-now path]
(doall (make-some-true till-now path)))
(make-all-false the-map))))
the print "success-in2" wont get printed out
success, and success-in does
it is not, I printed it out
it just doesnt work as expected, so I need to debug it.
(defn assoc-with-values [the-map paths]
(.log js/console "success"
(str (vec (reduce
(fn [till-now path]
(doall (make-some-true till-now path)))
[{:name "something" :children [{:name "deeper" :state false}] :state false}])))))
I tried it with a vector, so it doesnt depend on it
thats just one value. so the reduce fn isn't called and just returns that value since there is no init provided.
I check it out.
omg, I forgot the coll
it was the paths
, forgot to add it to the end