This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-02
Channels
- # announcements (11)
- # aws (2)
- # babashka (42)
- # beginners (26)
- # calva (17)
- # cider (1)
- # clara (2)
- # clj-kondo (44)
- # clojars (30)
- # clojure (43)
- # clojure-australia (6)
- # clojure-europe (29)
- # clojure-gamedev (4)
- # clojure-greece (1)
- # clojure-nl (4)
- # clojure-spec (4)
- # clojure-uk (6)
- # clojurescript (28)
- # cursive (16)
- # data-science (1)
- # datahike (4)
- # datomic (26)
- # emacs (6)
- # events (3)
- # fulcro (11)
- # graalvm (7)
- # holy-lambda (118)
- # java (9)
- # jobs (1)
- # leiningen (3)
- # lsp (21)
- # luminus (2)
- # malli (13)
- # membrane-term (1)
- # music (1)
- # nrepl (3)
- # off-topic (38)
- # pedestal (2)
- # polylith (39)
- # re-frame (33)
- # reagent (7)
- # releases (1)
- # remote-jobs (4)
- # rewrite-clj (28)
- # ring (21)
- # sql (2)
- # tools-deps (23)
- # vim (4)
- # xtdb (15)
How well do you know your chrome console utilities... https://developer.chrome.com/docs/devtools/console/utilities/
debug(function) and monitor(function) are news to me
More on the same topic on HN today https://news.ycombinator.com/item?id=29071700
https://christianheilmann.com/2021/11/01/developer-tools-secrets-that-shouldnt-be-secrets/
I’m looking for the name of a concept, it is related to debouncing and throttling, but not quite the same:
Imagine you have some pure function slow
which is slow, and you’re in a multi threaded environment, so multiple threads can call slow
with the same arguments, thus producing the same result, concurrently.
What I want to ensure is that if we have a thread one which has already called slow
with args args
, a thread two, calling slow
with args args
is kept waiting until slow
has returned a value for thread one, and gets the same return value, ie we do the slow computation once, but both threads get an answer.
AFAIC memoization will not work here, because it won’t block caller two.
So, not really looking for an implementation, but rather what something like this is called?
So the problem I’m describing is this: https://en.wikipedia.org/wiki/Cache_stampede
sounds a bit like the use case for https://clojuredocs.org/clojure.core/delay
If you memoize the function and return a delay you're golden. If the arguments are complex memoization might have its own overhead
Of course I didn’t tell the whole story. This should of course work across several servers, so basically distributed. Searching for “distributed promise” gave me this https://github.com/jpwilliams/distributed-promise
> but rather what something like this is called? perhaps 'grabbing a distributed lock'? IIRC it's what I've seen used commonly/informally whenever a computation is protected by a redis lock
Solution I used in Rust, map with shared futures, https://github.com/gklijs/schema_registry_converter/blob/f3ef437d7851364b54160c6f06fe43b205cdd241/src/async_impl/avro.rs#L197
Don't know of an official name for this, but feels like a specialization of memoize? Compute once memoize? Optimized memoize? Queued compute memoize? Distributed memoize?
This is the right thing to do on one machine!
Oh whoops thought that would be threaded. I meant a cache with “delay” values. Everyone stampedes and blocks on reading the delay created and read by the initial caller
“dataloader” is a popular JS library that solves this problem, and many other ecosystems have copied it
I think of it just like memoization of a function that returns a promise/future with the result of the computation, rather than the result itself
Has anybody stumbled on a decent enough name yet @U04V5VAUN? Cost effective memoize? Locking memoize? Next-gen memoize? (I seem to like including “memoize”).
async-memoize perhaps?
It's clearly a thunk / delay, so memoized-delay is legit.
(defn memoized-delay [f] (memoize (fn [& args] (delay (apply f args)))))
Keep in mind that if args are big then you'll pay a cost on the lookup, so a specialized implementation might be required
I think you often want a freshness check to see if you should return the cached delay or compute a new one
e.g. like dataloader, that ensures requests (but could also be computations) over a period of time aren’t done twice, but after some lag evicts the cache
Memoized-delay is a bit odd since you are not returning a delay
You are augmenting a function to both be memoized and return a delay, so you want a verb
Hey guys, anyone know if anyone's attempted to write Eclipse plugins in Clojure? I really like DBeaver and was thinking I could write an Execution Plan visualizer or something
Is there a code city generator for clojure? ( https://wettel.github.io/codecity.html )
https://codescene.com/?hsLang=en - you may want to try this, it definitely supports clojure (it is also written in it).
Yea, I think I saw a presetnation someone from codescene did... It is worth checking out... although Im partial to seeing a city style layout, as that seems to make sense to me.
"Accidental 'Simple Made Easy'" https://www.infoworld.com/article/3639050/complexity-is-killing-software-developers.html
I wonder if he's heard of clojure