This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-16
Channels
- # aatree (1)
- # admin-announcements (6)
- # alda (3)
- # beginners (66)
- # boot (41)
- # cider (4)
- # cljsjs (3)
- # cljsrn (18)
- # clojure (146)
- # clojure-android (2)
- # clojure-nl (1)
- # clojure-russia (35)
- # clojure-sdn (2)
- # clojure-sg (5)
- # clojure-uk (41)
- # clojurescript (116)
- # datomic (12)
- # dirac (40)
- # docker (2)
- # editors (2)
- # hoplon (85)
- # immutant (19)
- # jobs (1)
- # keechma (2)
- # lein-figwheel (8)
- # mount (33)
- # off-topic (1)
- # om (114)
- # onyx (159)
- # parinfer (24)
- # proton (3)
- # reagent (4)
- # ring-swagger (15)
- # uncomplicate (7)
- # untangled (93)
- # yada (30)
Is it possible to specify placeholders while using the partial macro? Something like the following ` `
@vigneshm: I don't think (but I don't know for sure) you can easily partially apply out of order. You could do something like (#(foo % arg2) arg1)
@urbanslug: Thread is accessible without any libs.
(future (Thread/sleep 4000)
(println "I'll print after 4 seconds"))
(println "I'll print immediately")
in general if you're looking for useful libraries though check out http://www.clojure-toolbox.com/
@urbanslug: Thread refers to the java class: https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html
@lmergen: they're called threading operators I think
and i suppose the difference is whether they pass along their first or their last argument?
exactly
no problem
I generally call them "thread first" and "thread last"
so, i think someone needs to hold my hand a little bit with this, just as an excercise
I'm not sure if they're official terms, but they're both commonly used and easily googleable
consider this code:
(defn by-email [email]
(map #(dissoc % :password)
(select user
(where {:email email}))))
that could be rewritten to
(-> (select user
(where {:email email}))
(map #(dissoc % :password))))
right ?Yes, you'd use thread last ->>
, because you want the result of the select to be the last element in the map invocation
yes, but, i am already using partial application of the map function, so it only accepts a single argument... or is this macro doing more magic under the hood?
The macros takes the result of the preceeding expression and "thread" it into the next one. So the thread first works like this, putting the result of the select expression where the underscore is in the map invocation (-> (select ....) (map _ some-fn))
In your case, you want to use thread last ->>
to put it at the end
(->> (select ....) (map some-fn _))
and what would i do if it sometimes requires the first, and sometimes requires the last argument?
There's another form called as->
which allows you to bind the argument passed to a name
That's right. These threadings are macros that transform the contents
You'll noticed that most of the sequence functions have the sequence as their last argument so they are amenable to ->>
That's right. And most of the hash-map functions take the map as their first argument, as well.
anybody have any familiarity with reporting over sockets? likely using Sente https://github.com/ptaoussanis/sente
@lmergen: @codonnell @danmidwood: this is super handy if hard to google things come up: https://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/
I'm playing around with re-frame and re-com. It's going well. But I'm trying to figure out the best way to toggle a class on a list of anchor tags.
@samueldev: What are you needing any?
for?
I've got the following data structure: {:show-confirm-modal false :show-quit-modal false}