--
You received this message because you are subscribed to the Google Groups "Elements of Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elements-of-clo...@googlegroups.com.
To post to this group, send email to elements-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elements-of-clojure/47d129b1-d3d8-41fb-83bb-5bcc5c75bd60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
That's a good question. I think that in that case, absent any other context, I'd call it `p`, especially since I don't want to shadow the `primes` function unnecessarily. As you say, though, `p` is far from self-explanatory. I think expanding on the "you shouldn't have to look at the right side" advice would be useful, I'll have to think a bit more about it, though.Thanks for the counter-example,Zach
On Tue, Mar 29, 2016 at 7:49 PM Ben Brinckerhoff <bhbrinc...@gmail.com> wrote:
Zach,--I really enjoyed the sample chapter on naming and I look forward to the rest of the book. Incidentally, "Always Be Composing" is one of my favorite talks.In the sample chapter, there are several pieces of good advice:"If a function takes an id and returns a binary payload, it should be called get-payload.""If a function only transforms data, we should avoid verbs wherever possible""The right side is a deeper level of the code, relevant only if the what of europa doesn’t satisfy, and we need to understand the how"I like these guidelines, but I was wondering if you had advice for `let` bindings that shadow a function name. e.g.(let [primes (primes numbers)]{:primes primes:primes-squared (map * primes primes))I realize that's a silly example, but the relevant parts of the example are:1. The `let` binding allows us to avoid duplication2. The function name `primes` is the natural choice for the name of the result3. If we replaced with a shorter name, like `p`, it requires that the reader looks at the right side of the binding to understand the value.I find this comes up fairly often in my Clojure code. If you had advice that would naturally fit in the naming chapter, I suspect it would be useful to others as well.Best wishes,Ben
You received this message because you are subscribed to the Google Groups "Elements of Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elements-of-clojure+unsub...@googlegroups.com.
To post to this group, send email to elements-of-clojure@googlegroups.com.
To post to this group, send email to elements-...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to elements-of-clo...@googlegroups.com.
To post to this group, send email to elements-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elements-of-clojure/47d129b1-d3d8-41fb-83bb-5bcc5c75bd60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Elements of Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elements-of-clo...@googlegroups.com.
To post to this group, send email to elements-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elements-of-clojure/3d0c9b8d-dcc7-4ec1-b103-48875116752e%40googlegroups.com.