This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # beginners (4)
- # boot (186)
- # cider (68)
- # cljsjs (2)
- # cljsrn (6)
- # clojure (103)
- # clojure-dev (1)
- # clojure-russia (117)
- # clojurescript (40)
- # community-development (31)
- # cursive (2)
- # data-science (7)
- # datomic (6)
- # devcards (2)
- # editors-rus (2)
- # emacs (2)
- # jobs (2)
- # ldnclj (2)
- # lein-figwheel (41)
- # off-topic (5)
- # om (50)
- # overtone (2)
- # re-frame (36)
- # reagent (1)
- # spacemacs (3)
- # yada (2)
@profil not sure what you mean, but you'd either had to use SSEs or send a separate request get new data anyway.
Is there a non-blocking get all messages on channel function in
core.async? Sort of like
poll-all! or similar?
Has anyone here worked on abstractions over regular expressions (or some other string matching mechanism)? Specifically looking to build some abstraction where non-technical users can build out filters that essentially “compile” to executable regexps
They are instances of java's regex but the literal to create one minimises the need for escaping, so you might need to do some editing after you created your regex with this
@sonelliot I'm assuming your chan is buffered since you have items in them. Perhaps running
seq on your buffer element would help: http://tgk.github.io/2013/10/inspect-core-async-channels.html
what is the idiomatic way to perform updates to atoms if I have a map and I would like to change multiple key value pairs in one go
right now I am using #(swap! my-atom update-in [:key-i-want-to-modify] function-to-bring-about-modification )
I want to get the result of calling (f (f (f x))), where the number of nestings is arbitrary. Something like
(defn nested-calls [fn initial n] (last (take n (iterate fn initial)))). It seems to me like this is one of those things where there is most definitely a core function that does exactly this, which would be more idiomatic to call rather than to construct my made-up nested-calls fn, but I haven't come across it. Does anyone know if there is such an fn in Clojure core?
user=> (doc iterate) ------------------------- clojure.core/iterate ([f x]) Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effect
@reefersleep: I’m not sure if there’s a single function in core that combines all those together. Though I might use
nth in place of combining
(defn produce "Returns a lazy sequence of colls from a recursive, axiomatic, transformative process." [seed prep-f get-xf] (letfn [(process [coll] (lazy-seq (when (seq coll) (let [new-coll (into (empty coll) (get-xf coll) (prep-f coll))] (cons new-coll (process new-coll))))))] (process seed)))
@hden: I am already using a loop/recur construct, but thought that it was a bit cumbersome. I've used loop/recur many times, and it has seemed cumbersome ever since the third time or so, because all I want to do it is to recur until a counter has reached zero. I'm thinking that
is really too much boilerplate to do that.
(loop [result coll counter counter] (if (zero? counter) result (let [new-result (... do stuff here)] (recur new-result (dec counter)))))
@meow: I'll have to have a look at your
producewhen my brain's fueled up on sleep.
some use with quil here: https://github.com/pkobrien/sandbox/tree/master/quil_sketches/src/quil_sketches
Let me just push my latest changes, then you can see my impl - I think/hope it's simple enough to read through, even without documentation
@moxaj: is that because the macro is expanded at compile time, but the binding happens at run time?
@stig nope, no macros involved here. Map returned a lazy sequence, and by the time it was evaluated, the binding was already gone
oh! I saw the
[email protected] and thought “macro” without noticing the defn rather than defmacro :-O