This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-25
Channels
- # beginners (32)
- # boot (1)
- # cljs-dev (25)
- # cljsrn (1)
- # clojure (35)
- # clojure-dev (6)
- # clojure-nl (4)
- # clojure-russia (12)
- # clojure-spec (13)
- # clojure-switzerland (2)
- # clojurescript (63)
- # cursive (9)
- # datomic (18)
- # dirac (32)
- # graphql (6)
- # luminus (8)
- # off-topic (18)
- # pedestal (5)
- # protorepl (1)
- # re-frame (30)
- # remote-jobs (5)
- # untangled (61)
- # yada (7)
does any one knows how should i use fast-resource or even resource to server some static files on pedestal ? how should the route be like ?
Hey fellow Clojurians, I'm looking for a lein plugin that can deploy binaries directly to github releases (similar to https://github.com/aktau/github-release) any ideas?
Done see any at https://github.com/technomancy/leiningen/wiki/Plugins
seems like something you could do with lein shell
if it doesn't need to be cross platform https://github.com/hyPiRion/lein-shell
guys, I’m struggling to make my own flat tail call, can you guys give me some enlightenment ?
(defn flat
[[h & t :as list]]
(cond
(empty? list) nil
(sequential? h) (concat (flat h) (flat t))
:else (cons h (flat t))))
are you aware that clojure never optimizes tail calls?
generally with list processing, you don't want to use recur (which acts like an optimized tail self call) but instead make a lazy-seq, which works with your current code if you wrap the else (lazy-seq (cons h (flat t)))
> are you aware that clojure never optimizes tail calls? yeah, but the loop-recur ( looks like uses go-to ) can help me with that, isn’t ?
you could use recur, but that tends to be clumsy for sequences
especially with a function that has a tree call structure
every call leads to 0 or more self-calls
as opposed to 0 or 1, which is linear, 0 or more means you end up with a tree of calls
and a linear series of calls is neccesary for tail call -you can't have two tail calls
you can force it by adding a state accumulator which makes the code more complex and moves data out of the stack and into the heap
correct me if I’m wrong, but all tail call function they have some kind of accumulator, isn’t ?
not always - but it's very common
actually I think a tail call function with no accumulator would be pretty weird
but I could see it for eg. something that repeatedly accesses a resource and eventually returns a result
clojure is not lazy by default, like haskell right, how the lazy works on clojure , (lazy-seq (cons h (flat t)))
right - but many functions are lazy
including concat
that's only if you call str - just printing won't do that
+user=> (str (map inc (range 10)))
"clojure.lang.LazySeq@c5d38b66"
+user=> (println (map inc (range 10)))
(1 2 3 4 5 6 7 8 9 10)
nil
and if you need to build up a string, pr-str
will help
user=> (str "fixed: " (pr-str (map inc (range 10))))
"fixed: (1 2 3 4 5 6 7 8 9 10)"