This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-14
Channels
- # admin-announcements (2)
- # beginners (32)
- # boot (217)
- # cider (20)
- # cljsjs (25)
- # cljsrn (9)
- # clojure (87)
- # clojure-android (7)
- # clojure-austin (4)
- # clojure-belgium (10)
- # clojure-canada (13)
- # clojure-dev (28)
- # clojure-dusseldorf (2)
- # clojure-greece (119)
- # clojure-nl (1)
- # clojure-russia (22)
- # clojure-spain (3)
- # clojure-spec (81)
- # clojure-uk (54)
- # clojurescript (32)
- # community-development (2)
- # core-async (19)
- # cursive (18)
- # datascript (5)
- # datomic (1)
- # dirac (22)
- # emacs (22)
- # hoplon (198)
- # incanter (1)
- # instaparse (4)
- # jobs (3)
- # keechma (15)
- # ldnclj (2)
- # lein-figwheel (14)
- # mount (8)
- # om (78)
- # om-next (4)
- # onyx (37)
- # other-languages (1)
- # pedestal (6)
- # re-frame (22)
- # reagent (25)
- # ring-swagger (17)
- # robots (1)
- # slack-help (1)
- # spacemacs (7)
- # specter (50)
- # spirituality-ethics (3)
- # uncomplicate (5)
- # untangled (1)
- # yada (17)
Hello!
(let [ch (chan)]
(thread
(job-1))
(thread
(job-2))
(close-ch))
I would like to close ch after job-1 and job-2 are done. What's the best way to do it?@kronos_vano: Unless you need to, it should be fine to leave the channel open until the garbage collector gets to it. See http://stackoverflow.com/questions/28888340/should-clojure-core-async-channels-be-closed-when-not-used-anymore
Yep, I know, but in my case it should be closed. For now, the best option I see is to use futures (instead of threads) and use (mapv deref futures)
before calling (close! ch)
careful: mapv is lazy so you may not get the result you want. you can use doseq instead
mapv is lazy? Are you sure?
@bronsa It makes sense. thx
any recommendations for intro-to-clojurescript books, preferably ones that focus more on the -script part?
@swizzard: it looks like Clojurescript Up and Running is due for a refresh this fall. In the meantime, maybe https://funcool.github.io/clojurescript-unraveled/ + https://github.com/magomimmo/modern-cljs
yeah i saw about up & running...unfortunately waiting a few months doesn't help me pad my resume now 🙂
@swizzard: learn clojure, once you have that the real challenge with clojurescript is interop with the new host (javascript). I would write some small apps that do some interop with other js libraries. Other than that once you know clojure its pretty straightforward. Understanding popular JS libraries and how to work with them in CLJS is the sticking point.
Hey folks, trying to get a better idea of how to use the ->
operator and had some trouble thinking through nested anonymous functions
could someone help me understand what it would look like to use the ->
with the following function:
(defn item-dates
"filters returns the two relevant fields from jira response"
[hist]
(map #(select-keys % [:items :created]) hist))
@jswart i've been learning/using clojure for a few years, i was just looking for some stuff that has specific pointers on js interop and like, thinking clojurically about web stuff
@dmbennett: that's not a great candidate for ->
really
@swizzard: most people in CLJS seem to like React and a CLJS flavor. If you can do react in CLJS you are likely okay. If you can build a CLJS frontend that reliably talks to the CLJ backend then you will be hired (anecdotally speaking).
right now i've got a personal project that's an es6 SPA talking to a python-backed REST api, and it's getting out of hand
i could capitulate and go with some js framework, but i'd rather learn/practice cljs than whatever the flavor-of-the-month js mvc thing is
anyone know of the most idiomatic design pattern for constructing urls in clojure? Ex. I have a base url, I need to iterate through a variety of relative URLs, and I have some params
Some folk like to use https://github.com/cemerick/url
Some folk do strings, some folk do java.net.URI interop
Thanks, that turned me on to a different idea http://blog.wjlr.org.uk/2015/01/15/string-interpolation-clojure.html