This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-08
Channels
- # alda (10)
- # beginners (15)
- # boot (16)
- # business (2)
- # clojure (68)
- # clojure-czech (1)
- # clojure-italy (3)
- # clojure-japan (71)
- # clojure-russia (32)
- # clojure-uk (2)
- # clojurescript (134)
- # core-async (84)
- # datomic (27)
- # devcards (13)
- # hoplon (3)
- # ldnclj (8)
- # ldnproclodo (1)
- # lein-figwheel (2)
- # melbourne (1)
- # off-topic (29)
- # om (53)
- # re-frame (7)
- # reagent (15)
- # yada (50)
if-let speaks of bindings (plural) in its docstring, but you can only provide one. Is that a typo?
@borkdude: I'd say it is
@borkdude: destructuring can give you multiple bindings - compare the docstring with when-let and let and it seems consistent
@mccraigmccraig: can you give an example of when-let with multiple bindings?
(for [x [{:foo 10 :bar 20} nil]] (when-let [{:keys [foo bar]} x] [foo bar])) ;=> ([10 20] nil)
I didn't think of that
@mccraigmccraig: I'm not sure if that's what they mean in the docstrings, I see it as a workaround 😉
@borkdude: seems explicit to me. compare the form given in let
's docstring: (let [bindings*] exprs*)
with when-let
's doctstring: ([bindings & body])
I was confused by the docs for if-let as well. Regarding bindings. Wasn't clear until I looked around a little for examples.
doing by my own, but feeling too much OO style. need to read some idiomatic web clojure project
@oliv: have you looked at http://luminusweb.net ?
yeah compojure and luminus. I'm using compojure btw. but I am looking for an open source web project to read the code. you know what I mean ? want to see how they structure the code in a idiomatic way
@oliv: I learned a lot about core.async and component by looking at this project: https://github.com/gar3thjon3s/leacher. It's kinda neat.
@oliv: I sometimes get lucky just using github's code search feature
just got some weird clojure using OO lingo, trying to translate the gateway pattern to clojure, facade pattern to clojure 😞
maybe I'm wrong, but looks like someone with OO background ( like me ) jumping to clojure world
i'm thinking something like the following your project.clj :jmx {:port 6666 :ssl false [etc…]}
@oliv: I think the facade pattern would just be known as a "wrapper" in the Clojure world, for example clj-http wraps the Apache http client: https://github.com/dakrone/clj-http as for the gateway pattern, maybe something like tentacles which access the Github api: https://github.com/Raynes/tentacles
in Clojure these things look a lot simpler though: in both cases there is a core
namespace that makes up the core API, and then all the business of the implementation is handled in various other namespaces
tdantas: this may also be interesting re patterns : http://www.c2.com/cgi/wiki?AreDesignPatternsMissingLanguageFeatures - it has a common lisp focus, but much of it is applicable to clojure
thank @mccraigmccraig do you guys knows any good web open source project in clojure ? need to read some good code ( web related )
@oliv: clojars is open source: https://github.com/ato/clojars-web Web interface for deploying Clojure libraries
@oliv: do you mean websites, or components for building websites ?
@mccraigmccraig: web projects
not the components ! I'm reading a lot of components to get the feeling ( compojure, ring )
4clojure is nice for getting up to speed. There seems like there are fewer resources for designing larger systems though. You have to work as part of a team, find large projects, and mostly go at it on your own.
@oliv: If you want something to help with an understanding of FP, I found Brian Marick's book pretty helpful. https://leanpub.com/fp-oo
@shaun-mahood: thank you so much
@oliv: One web project that might be helpful is https://github.com/yogthos/yuggoth , the blog engine from the creator of Luminus - I haven't looked at it much but it's on my list. His book is also very good, I'm currently rereading it but it's a great starting point for web development https://pragprog.com/book/dswdcloj/web-development-with-clojure
@oliv: And I've also found Clojure Applied to be fantastic for understanding how to structure Clojure code, haven't finished reading it yet but every time I pick it up I find something new https://pragprog.com/book/vmclojeco/clojure-applied
speaking of blog engines, cryogen is a pretty nice piece of software too https://github.com/cryogen-project/cryogen
@shaun-mahood: just a note that it’s a somewhat outdated now, might still be useful for some examples of how to do things like file uploading, but probably not the ideal base for new apps
@yogthos: The book or the blog engine?
@shaun-mahood: the blog engine
@shaun-mahood: although the book is getting somewhat outdated now as well, especially anything related to lib-noirt
@yogthos: Good to know, thanks. Do you have an ETA on the new edition?
hoping to get the beta out within a month or so, just working with the editor now to get everything in order
@yogthos: Awesome. The current edition is still really helpful, it was one of the books that got me started actually being able to build stuff.
My local library just got the first edition not too long ago. I still cant believe my local library has a bunch of clojure books! If it were not for them, I would have never started with clojure.
the second edition is going to have a very similar style and I’m focusing on using ClojureScript this time around
Grand Rapids Public Library! They have a bunch of great IT books, even some Haskell ones.
@yogthos: Anything about react in the new edition? I notice that you write about reagent fairly often on your blog.
Anybody: I already posted this in core-async, but there are 10x as many people in here, and I'm just trying to find someone who knows:
Is there core.async API for determining if a channel is closed? If it still has values available for taking?
Or, given a channel that resulted from a (go)
call, is there a way to distinguish between nil
(channel closed, no values to take) and nil
(`(go (println "hey"))` returned nil
) ?
thanks, ghadi