This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-14
Channels
- # aatree (1)
- # admin-announcements (1)
- # beginners (12)
- # boot (359)
- # cljs-dev (23)
- # cljsjs (2)
- # cljsrn (1)
- # clojure (53)
- # clojure-czech (5)
- # clojure-madison (1)
- # clojure-russia (15)
- # clojured (8)
- # clojurescript (16)
- # community-development (2)
- # core-async (6)
- # cursive (19)
- # datomic (31)
- # emacs (48)
- # euroclojure (3)
- # hoplon (29)
- # microservices (7)
- # mount (46)
- # off-topic (7)
- # om (11)
- # proton (74)
- # reagent (4)
- # spacemacs (3)
guys what’s the proper way to memoize a http call?
i end up with clojure.core$memoize$fn__5479@3ba3c81c
result
i’d like to get some param via http and later use it as param for all further network calls
this (defn memoized-timestamp [] (memoize get-timestamp))
doesn’t return me a proper timestamp 😞
So, I have macro that clears a cache atom. What I'd like is for it to be able to empty the whole atom if no arg is passed, or clear the passed key if there's an arg. What would be the most idiomatic way to do this? Multi arity? A cond?
@doddenino: Why a macro? Apart from that a simple if else should be enough, or am I missing something?
@sveri I'm creating a small library to understand how macros work I wanted to find a clever solution, but I ended up using multi arity. It seems to work!
@doddenino: no need to make things harder than they are, for a simple if else I would prefer to stick with if / else
Also it sounds like it would be better to have an explicit clear-cache
function and another function that updates an atom. Having one function doing both is hard to read and therefore hard to understand.
@doddenino: Of course, you were just asking for the idiomatic way