This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-09
Channels
- # announcements (4)
- # beginners (71)
- # boot (258)
- # braid-chat (7)
- # business (3)
- # cider (5)
- # cljs-dev (5)
- # cljsrn (64)
- # clojure (154)
- # clojure-canada (1)
- # clojure-poland (112)
- # clojure-russia (290)
- # clojurebridge (1)
- # clojurescript (60)
- # community-development (1)
- # core-async (25)
- # cursive (9)
- # data-science (1)
- # datomic (40)
- # editors (14)
- # events (2)
- # hoplon (2)
- # jobs (3)
- # ldnclj (51)
- # lein-figwheel (2)
- # luminus (1)
- # off-topic (5)
- # om (57)
- # onyx (29)
- # overtone (1)
- # parinfer (52)
- # portland-or (1)
- # proton (17)
- # quil (2)
- # re-frame (77)
- # reagent (1)
- # ring-swagger (20)
- # spacemacs (1)
- # test-check (4)
- # testing (13)
- # yada (1)
Hey @meow, thanks for the review!
I'll keep the loop/recur thing in mind. (I'm inclined to avoid it myself just out of its verbosity : )
And it's good to hear that I'm on the right path
why not recommend loop/recur for slower code as well? because recursive fns are easier to debug? or, because lazy seqs are more clojure-like?
when coming from a non-functional background people will reach for loop/recur instead of reduce most of the time
hi there I'm in a little problem regarding selmer template library. not sure this topic is related here. Highly appropriated someone give a hint about this. http://stackoverflow.com/questions/35285822/how-to-add-a-dynamically-concatenated-file-name-for-include-tag-in-selmer-clo
I know of those three - https://github.com/friemen/async-ui, https://github.com/aaronc/fx-clj, https://bitbucket.org/zilti/clojurefx
Can't tell you which is better though, didn't use any of those, you'd have to check them out on your own
I hear you, @dm3, and I always keep this in mind. So far, I haven't had troubles with performance.
@sander: Like I said, loop/recur can be verbose, and that can be reason enough in itself not to use it. It is for me I don't any other explicit arguments against it.
*don't know
Hi, what it the right approach to test async code with clojure? I’m not using core.async, I just have a small function which calls a callback at the end. Is there anything for that? Didn’t find anything in clojure.test
oh, maybe I should ask it in testing channel
ok, promise is a key - I can wrap callback with it and block until promise is fulfilled
what's the hivemind's opinion on dynamically def'ing vars, say, in a loop?
like, (doseq [[k v] some-map] (eval `(def k v)))
we have a namespace that deals with recognized MIME types
but I'm thinking I might be doing it wrong
a big map of keywords to mime types and other info
defmimetype
it is hard to infer what's there when looking at the code
eval also confuses my editor
well, with read-string it does
@jcromartie: you don't need eval
+`def`, you can intern vars at runtime with intern
ah, intern, good idea
well, I like the fact that if I mess up a var it gives me an error at load time
rather than waiting until much later to find out that the keyword I used is not recognized
Read through this article from the JUXT blog, https://blog.juxt.pro/posts/xpath-in-transducers.html , and wondering, how does one implement the descendants as a transducer? Is it recursive?
Am I doing something dumb? I see in
printed in the repl, but not when running the file separately.
(defn try-ssh []
(println "out")
(for [machine machines]
(println "in")))
with core.async, what's the standard way to wait for all of my workers to finish processing my task queue?
Hey guys… Is this a bug in clojure? https://www.refheap.com/114616
So help me understand why the laziness would result in it using the un-redef’d version of the fn please
They do when it’s evaluating. I figured the fn that’s printing this into my repl would be evaluating it?
from the with-redefs
docs:
> After the body is executed, the root values of all the Vars will be set back to their old values.
Hi there, qq. If i :require
a namespace :as
something, I don’t seem to be able to use things like ns-publics
on that symbol or var
@wunsch: Clojure doesn't work like Python where imported vars are brought into the current namespace
instead they are added to a alias list of sorts
@tbaldridge: is there a way to expand that alias?
You can use https://clojuredocs.org/clojure.core/ns-aliases to look up the list of required/alised namespaces
give me a sec to look up if there's something like that for vars
Ah, looks like this should do it: https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/ns-refers
thanks tbaldridge! looks like I can also do something like (get (ns-aliases *ns*) :alias)
yep, that should work
I was just thinking: could memoize be a security risk?
in the form of a Denial of Service
if you memoized something based on user input, an attacker could send enough different data to OOM your JVM?
@jcromartie: cache eviction is not part of memoize
, so yes, I’d think that would be a concern if it’s based on user input.
I don't think it would ever actually happen, but yeah
in this case it's HTTP header values
I'm starting to prefer cond over defmulti and defprotocol wherever possible
I only use cond
when it’s returning something simple. If there’s any complexity to processing, I stick with defmulti
.
I suppose most of the time I am returning something simple
or it's just calling some other function in turn
I think there’s some added speed/efficiency with defmulti
over cond
but I could be wrong.
This is a good article on the subject http://insideclojure.org/2015/04/27/poly-perf/
interesting, thanks
so, multimethods are faster than cond
on average
according to this https://github.com/puredanger/poly-timing
So case
would be the better comparison since it also caches, right? If applicable that is
Ah, I got that from the article. "Because both case and multimethods use a cache […]"
Meanwhile, I’m having a bit of trouble intelligently walking a tree-map. I need to hit every node, and based on either the name of the key or the type of the value, I need to modify the value (e.g., convert a val's vector of strings to a vector of keywords or if the key is :whatever
convert its val to a keyword). I’ve been messing with clojure.walk
but I’m kind of spinning my wheels here and I don’t want to waste too much time on this or re-invent the wheel. Any advice?
No book that I know of, but it might be covered in one of the Clojure books. Most don't go into that topic in much detail.
Does anyone have experience integrating sente and component? I'm at a loss as to how to inject dependencies into my message handler.
good call, thanks
@codonnell: don't have much time to explain now, but that's how I do it - https://gist.github.com/jaen/cc8600e682eb65ec4a55
I'll take a look! At the least, it's always good to practice reading other peoples' code.
But basically, this component takes the components it depends on, filters out those that have a AsyncHandlerProvider
protocol that has a method which returns map of form {dispatch-value handler}
and then shoves that into a multimethod.
I'll let you know if I have questions. And if you can't get back for a while, no worries.
I really appreciate any kind of lead on how to make this work.
isn't that just SQL?