Fork me on GitHub
#clojure
<
2015-10-08
>
borkdude09:10:04

if-let speaks of bindings (plural) in its docstring, but you can only provide one. Is that a typo?

mccraigmccraig09:10:19

@borkdude: destructuring can give you multiple bindings - compare the docstring with when-let and let and it seems consistent

borkdude09:10:01

@mccraigmccraig: can you give an example of when-let with multiple bindings?

mccraigmccraig10:10:42

(for [x [{:foo 10 :bar 20} nil]] (when-let [{:keys [foo bar]} x] [foo bar])) ;=> ([10 20] nil)

pesterhazy10:10:19

I didn't think of that

borkdude10:10:44

@mccraigmccraig: I'm not sure if that's what they mean in the docstrings, I see it as a workaround 😉

mccraigmccraig10:10:05

@borkdude: seems explicit to me. compare the form given in let's docstring: (let [bindings*] exprs*) with when-let's doctstring: ([bindings & body])

jstew13:10:17

I was confused by the docs for if-let as well. Regarding bindings. Wasn't clear until I looked around a little for examples.

tdantas13:10:54

do you guys could recommend any good web open source project using clojure ?

tdantas13:10:37

doing by my own, but feeling too much OO style. need to read some idiomatic web clojure project

tdantas13:10:20

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

jstew13:10:23

@oliv: I learned a lot about core.async and component by looking at this project: https://github.com/gar3thjon3s/leacher. It's kinda neat.

tdantas13:10:59

will take a look for sure !

pesterhazy13:10:49

@oliv: I sometimes get lucky just using github's code search feature

tdantas13:10:19

yeah, I'm afraid to say that I'm not lucky at all

tdantas13:10:06

just got some weird clojure using OO lingo, trying to translate the gateway pattern to clojure, facade pattern to clojure 😞

tdantas13:10:38

maybe I'm wrong, but looks like someone with OO background ( like me ) jumping to clojure world

timvisher13:10:34

is there a leiningen plugin that would turn on jmx?

timvisher13:10:36

or something similar?

timvisher13:10:19

i'm thinking something like the following your project.clj :jmx {:port 6666 :ssl false [etc…]}

pbostrom13:10:43

@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

pbostrom14:10:05

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

tdantas14:10:43

thanks for your time @pbostrom

mccraigmccraig14:10:41

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

tdantas14:10:53

thank @mccraigmccraig do you guys knows any good web open source project in clojure ? need to read some good code ( web related )

pbostrom14:10:17

@oliv: clojars is open source: https://github.com/ato/clojars-web Web interface for deploying Clojure libraries

tdantas14:10:32

perfect perfect @pbostrom

tdantas14:10:48

+1 for you

tdantas14:10:07

nothing more idiomatic than that 😄

mccraigmccraig14:10:24

@oliv: do you mean websites, or components for building websites ?

tdantas14:10:08

not the components ! I'm reading a lot of components to get the feeling ( compojure, ring )

jstew14:10:26

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.

tdantas14:10:41

but my focus is web projects ( like clojars as @pbostrom pointed )

shaun-mahood14:10:50

@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

tdantas14:10:25

@shaun-mahood: thank you so much

shaun-mahood14:10:43

@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

shaun-mahood14:10:51

@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

tdantas15:10:27

I bought the clojure applied

jstew15:10:55

speaking of blog engines, cryogen is a pretty nice piece of software too https://github.com/cryogen-project/cryogen

yogthos15:10:32

@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

shaun-mahood15:10:59

@yogthos: The book or the blog engine?

yogthos15:10:12

@shaun-mahood: although the book is getting somewhat outdated now as well, especially anything related to lib-noirt

yogthos15:10:16

err lib-noir

yogthos15:10:29

the new edition’s coming out soon though simple_smile

shaun-mahood15:10:46

@yogthos: Good to know, thanks. Do you have an ETA on the new edition?

yogthos15:10:56

hoping to get the beta out within a month or so, just working with the editor now to get everything in order

shaun-mahood15:10:11

@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.

yogthos15:10:20

glad to hear it simple_smile

jstew15:10:50

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.

yogthos15:10:57

the second edition is going to have a very similar style and I’m focusing on using ClojureScript this time around

yogthos15:10:14

@jstew: you have an awesome library simple_smile

jstew15:10:11

Grand Rapids Public Library! They have a bunch of great IT books, even some Haskell ones.

jstew15:10:54

@yogthos: Anything about react in the new edition? I notice that you write about reagent fairly often on your blog.

yogthos15:10:39

@jstew: yeah I work through a couple of reagent based apps in the book

jstew15:10:25

I'm definitely picking this one up then.

ajmagnifico20:10:19

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) ?

ghadi20:10:31

i'll respond over there

ajmagnifico20:10:41

thanks, ghadi

sdegutis21:10:04

What's the best way to handle text fields in Reagent?