This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-21
Channels
- # adventofcode (27)
- # announcements (2)
- # babashka (1)
- # beginners (111)
- # calva (11)
- # cider (82)
- # clara (6)
- # clojure (44)
- # clojure-dev (5)
- # clojure-europe (27)
- # clojure-nl (5)
- # clojure-spec (3)
- # clojure-uk (3)
- # clojurescript (29)
- # core-async (5)
- # cursive (4)
- # datalevin (1)
- # datomic (39)
- # exercism (4)
- # figwheel-main (1)
- # fulcro (32)
- # graalvm (7)
- # gratitude (1)
- # integrant (4)
- # jobs (1)
- # lein-figwheel (3)
- # leiningen (4)
- # lsp (3)
- # luminus (3)
- # meander (2)
- # nextjournal (1)
- # off-topic (10)
- # other-languages (26)
- # pathom (14)
- # polylith (9)
- # re-frame (16)
- # remote-jobs (1)
- # shadow-cljs (4)
- # specter (2)
- # sql (6)
- # timbre (2)
- # tools-build (12)
- # xtdb (9)
(letfn [(create [k depth]
(if (zero? depth)
(k {:id depth})
#(create
(fn [c]
(k {:id depth :child c}))
(dec depth))))]
(trampoline create identity 5000)
nil)
in clojure this works, in fact I can increase the depth to 40,000 or so, but in clojurescript I get a "Maximum call stack size exceeded."for clarity, an example of using a depth of 5:
{:id 5, :child {:id 4, :child {:id 3, :child {:id 2, :child {:id 1, :child {:id 0}}}}}}
(letfn [(create [depth]
(if (zero? depth)
{:id 0}
{:id depth
:child (create (dec depth))}))]
(create 5000)
nil)
works on my machine. the trampoline version above w/ 5000 does notthe answer is that I had an error in my trampolined version. the inner fn
that calls k
needs to return a thunk
(letfn [(create [k depth]
(if (zero? depth)
(k {:id depth})
#(create
(fn [c]
(fn [] (k {:id depth :child c})))
(dec depth))))]
(dissoc (trampoline create identity 50000) :child))
;; => {:id 50000}
What do people generally use for templates? Just simple text substitution stuff, not the sexpy html stuff
Maybe? Kinda? Seems there is also Cljstache. I tend to like Mustache implementations because of their simplicity. Seems Selmer is more advanced with filters and stuff. My needs are mostly glorified printf
I guess Selmer can also be used as glorified printf though, we'll see
@pepijndevos FWIW Selmer is also available in #babashka , but so is clojure.pprint/cl-format
and format
cl-format
probably qualifies as a glorified version of format
?
Hey, how does one get the final rendered html for a page using reagent?
@rbowen It is possible to use reagent.dom.server/render-to-string
Thanks @pavel.klavik, I'll give that a go.
I am trying to find a bizzare bug which only occurs in ClojureScript code compiled in advanced mode and only in Safari. After a fun evening of random debugging, I have found that it occurs in this function: https://orgpad.com/img/DpuNESB2FJbLm0P-eeYifP/download?token=AU25m6asVA56Cw6cceBK5Y The input a should be nil, but when passed into Lka, when printed there, it shows 0. When I copy this function on the side and add a log statement for the value of a, the issue disappears: https://orgpad.com/img/CwvFl3QIpCHL6IvsTpa3FJ/download?token=CsmOIOJNFKQ5t1VW8k7fFX
In Clojure, all three functions look like this:
All the inputs should be immutable Clojurescript values.
Other browsers - do they have nil
there as expected?
Have you tried creating a minimal reproducible example?
Haven’t checked but almost surely yes, the app works fine there and breaks after a few actions in Safari (both mac and ios)
Minimal reproducible example will be tricky.
The process of coming up with such an example can by itself shed quite a lot of light on the situation.
Surely. I will probably just hack the solution right now and will probably dig deeper if it resurfaces. I need to get working development on mac anyway if we want to support Safari better.
Ya :) browsers are overall a huge minefield everywhere, I have already discovered multiple Chromium specific bugs.