This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-15
Channels
- # admin-announcements (130)
- # alternate-reality (2)
- # aws (20)
- # beginners (49)
- # boot (1)
- # braid-chat (18)
- # cljsrn (54)
- # clojars (1)
- # clojure (70)
- # clojure-art (1)
- # clojure-japan (21)
- # clojure-miami (2)
- # clojure-my (7)
- # clojure-russia (60)
- # clojurescript (75)
- # community-development (12)
- # core-matrix (7)
- # cursive (23)
- # datomic (31)
- # dirac (2)
- # dunaj (3)
- # dysphemism (5)
- # editors-rus (1)
- # emacs (22)
- # events (9)
- # funcool (56)
- # hoplon (63)
- # human (1)
- # jobs (9)
- # ldnclj (7)
- # lein-figwheel (21)
- # leiningen (1)
- # off-topic (2)
- # om (61)
- # onyx (20)
- # other-lisps (2)
- # portland-or (1)
- # proton (26)
- # re-frame (27)
- # reagent (16)
- # ring-swagger (30)
- # spacemacs (6)
- # yada (5)
Wow I can't read the docs. dorun
always returns nil
, where doall
always returns the forced coll
. My bad.
Hello I'm wondering why a particular
automat
build in Travis CI passed despite ClassNotFoundException
s ... the related snippet is in #C0AB48493
Leiningen uses Stencil for templates.
https://github.com/yogthos/Selmer as an alternative
Anybody have a clever way to turn a vector of maps with the same structure into a single map keyed by one of the keys in the map. For example, {{:a 1, :b 2}, {:a 3 :b 4}] => {1 {:a 1 :b 2}, 3 {:a 3 : b 4}}
Best I can come up with is (zipmap (map :a v) v)
But it's not as efficient as a reduce
Close, but I don't want it to give me a vector of results for each key
Good idea about group-by, though. I looked at the source and it uses a reduce with transients. I might get some extra points for using transients
@jean @seancorfield @delaguardo Thanks! I'll go with stencil for now.
(def error-map {:error-403 "Error 403. Permission Denied."
:error-404 "Error 404. Page Not Found."})
(for [[k v] error-map]
(def-errors k v))
but the output of the last expression is just multiple definitions of function k
:
=> (#'edubot.pages.errors/k #'edubot.pages.errors/k)
I've already confirmed that k
and v
in the for loop are mapped correctly to the keywords and strings separately
I was trying to #_
-comment a thing with metadata and found out that it's enough to comment out the meta data like this: #_^{:key :a} [:a]
. However, before that I tried to comment out both the meta data and the value itself, and got a result I don't understand: [#_^{:key :a} #_[:a] ^{:key :b} [:b]]
is not [:b]
but []
. Why?
Well, exact answer would require someone who knows the Clojure reader Java code, but it looks as if Clojure reader pushes the reader macros on a stack and then applies it to forms by pushing from that stack. So this reader macro will then apply to the next form that's read, and since #_
comments out both metadata and the form it will be ^{:key :b} [:b]
.
I guess this would also explain this code - https://github.com/ztellman/automat/blob/master/src/automat/core.cljx#L157 - people were wondering about here not long ago.
@danielwoelfel: (into {} (map (juxt :a identity)) [{:a 1 😛 2} {:a 2 😛 3}])
i am using core.async. my question is if i thread(while true ( go some function))). would it end up running out of server resource?
go blocks use memory
@alexmiller: thanks, alex.
i am new to core.async. and there is API usage, but not much info about design patterns
so i am designing it like 3 channels, and thread read from channel, and go call a web service, after get response, save to the next channel.
the point is , the second service is slow, so some times the first channel exceed its limit.
@seancorfield: lein now supports using a custom renderer too, you can pass it in to renderer
when you initialize it
hey @jarodzz, those are common issues- multiple collaborating services in a pipeline taking differing amounts of time. in those cases it's up to you to decide, based on the requirements of the overall problem you're solving, what policies, or business rules, you want to have to handle the different circumstances. once you have clarity on your rules, then you can settle on an architecture/implementation, which maybe uses core.async or maybe does not. for example, if the goal of the web service is just to save/ack this incoming data, and the response doesn't depend on the enrichment step, then you might just want to write the incoming requests directly to the db, and set up a background task to ensure that each of them is appropriately enriched. in contrast, if the web service responses depend on the enrichment step, then you basically have a synchronous problem and you need to provision for 1M calls/day to the enrichment service- or find a faster enrichment service (or maybe employ a cache, etc) lots of variations in between those, but try to define the policies you want to have first, and then see if core.async is an appropriate mechanism
@jonahbenton: thanks for the details. in this case, i do need a realtime response.
the prototype works with a queue, as a temp buffer. but my problem is, if i read 1k from queue, go call step1, async put results to channel 1. then read from channel1 to go call step2. but if step2 is slow, i need to wait for it is empty to get new requests. i have no way to tell whether a channel is empty
gotcha. so it sounds like the use of core.async has introduced a dependency between the slowness of the enrichment and your ability to service new requests? because you are waiting to deliver a response to request 1 before serving request 2?
y. something like that. more like if i have 3 channel, moving requests 1->2->3, each step will enrich something. but i can't get new requests before channel1 is empty. otherwise, it's gonna fail at >!! ch
An #onyx / #datomic experience report written by @robert-stuttaford, that some of you may be interested in "just a small experience report which i hope will help some other Onyx users out: https://twitter.com/robstuttaford/status/687954517325950976"
oh, heh, yeah any questions most welcome!
@jarodzz yeah, it's a neat pattern, but it sounds like it doesn't capture the semantics you need. what you need is a synchronous pipeline that takes a ticker, downloads the ticker data, transforms, and then inserts, e.g. (-> ticker download transform insert). your web service handler could spin up a go block for each incoming ticker, and wait on a channel for the insert to complete to return a result to the user.
Good to know! I’ll have to take a closer look as I’m building a template system for Boot right now, based on Leiningen. https://clojurians.slack.com/archives/clojure/p1452865567013441
@jarodzz: there was an interesting post in the google group about a similar problem recently: https://groups.google.com/d/msg/clojure/_8fHJ3J-MYg/LCK9JbykCwAJ
@mpenet: you’re welcome 😛
Look into Cheshire for JSON processing (https://github.com/dakrone/cheshire).