On Wed, Mar 7, 2012 at 10:43 PM, Andy Fingerhut <andy.finger...@gmail.com>wrote:

> You might have a difficult time getting other Clojure coders to adopt the
> practice in their code, but would this be almost as good?
>
> (let [x 2]
> code)
>
> Achieving that would be as simple as hand-indenting it that way, or
> adjusting the auto-indenter of your favorite text editor to do it that way.
>  A couple of minutes of perusing clojure-mode.el for emacs didn't make it
> obvious to me how to do that, but I suspect it wouldn't be difficult.
>
> Andy
>
>
It's an interesting question as to how much of my psychological objection
to let is the added nesting versus the physical indenting.  I agree it
would be a worthwhile experiment to adjust the auto-indenter for a while
and see how it feels.

In the meantime, I *strongly urge* everyone to check out Grand's flatter
cond macro:
https://github.com/cgrand/parsley/blob/master/src/net/cgrand/parsley/util.clj

It lets you insert lets in the middle of cond expressions (like you can
currently do with for) like:
(cond
   (pos? x) 2
   :let [y (* x x)]
    (> y 20) 4))

This totally transformed my coding style and improved the readability of my
code substantially.  Highly recommended.  Since it is backwards compatible,
I very much wish it were part of the core, and see no reason that it
couldn't be.

--Mark

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to