This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-04
Channels
- # aleph (3)
- # beginners (37)
- # boot (45)
- # carry (1)
- # cljsrn (15)
- # clojure (78)
- # clojure-austin (2)
- # clojure-brasil (10)
- # clojure-czech (3)
- # clojure-dev (12)
- # clojure-dusseldorf (31)
- # clojure-hamburg (2)
- # clojure-italy (4)
- # clojure-poland (2)
- # clojure-russia (37)
- # clojure-spec (25)
- # clojure-uk (30)
- # clojurescript (160)
- # cursive (40)
- # data-science (1)
- # datomic (31)
- # emacs (7)
- # figwheel (4)
- # hoplon (73)
- # leiningen (1)
- # liberator (5)
- # luminus (7)
- # numerical-computing (1)
- # off-topic (31)
- # om (89)
- # onyx (66)
- # proton (5)
- # protorepl (1)
- # re-frame (18)
- # reagent (2)
- # ring (2)
- # spacemacs (1)
- # untangled (93)
- # vim (19)
- # yada (67)
is a do loop async?
@josh_tackett no, it is not
hmmm, is it possible to combine :as with prefix lists to bind the “whole” prefix to a var? consider this:
[taoensso.timbre :as log]
[taoensso.timbre.profiling :refer [profile]]
how would i specify a prefix list to handle this ?i figured i could do something like
[clj-time :as ctime [periodic :refer [periodic-seq]]
I wouldn't worry about it too much - you won't spend much time looking at your ns
declaration
Despite the "tidiness" of doing your namespaces in the nested form, they're significantly harder to grep for as well. So there's that.
Hey. How do I “combine” (min)
and (recur)
? It keeps saying that I Can only recur from tail position
...
@pawel.kapala you'll need to give us a bigger example I think.
But it seems like you're doing not doing (recur)
in the final position as it's supposed to be used.
https://stackoverflow.com/questions/10864172/clojure-can-only-recur-from-tail-position
yes I’m not doing it as a tail position, I’m aware of that, but I’m trying to find a solution for recursive function, that needs to calculate minimum of three recursive returns, something like that:
(if exit-condition exit-value
(min
(recur args)
(recur different-args)
(recur yet-another-args)))
Yep, that's the problem. My thoughts are to: Call back into the function in place of recur
- this will blow up depending on how recursive your stack is, shouldn't be used for large values
In order to prevent overflowing the stack, you probably want a non-recursive version of the function, especially given that you're recur'ing multiple times, this prevents you from taking advantage of any form of TCO
yeah it works without recur
, but I’m trying to fix that to use TCO
I don't think you can get TCO unless in the tail position. But I never fully wrapped my head around that part of the SICP book.
So this essentially means you wouldn’t be able (as in mathematically impossible) to use recursion multiple times and get TCO, right?
@dominicm thank you very much for your help, I’m gonna stick for non-recur version for now, and I’ll think about the algorithm itself to potentially eliminate multi-recursion. Thanks again!