Sean,

I agree that breaking things into smaller functions can potentially help.
Often, though, I find that a function begins by unpacking and computing a
large number of values that are all important for subsequent computations.
Dispatching these computations to helper functions would mean passing an
unwieldy number of variables.  One option is to have the helper functions
inside the main function, inside the scope of these bound variables so that
they don't have to be passed explicitly.  But this potentially means
several levels of nesting to bind the variables to their appropriate values
(possibly testing for nil and other such conditions before computing
further values), and then yet another level of nesting to create the helper
functions (possibly with letfn, which is poorly indented by most of the
IDEs last I checked).  In such scenarios, decomposing into inner helper
functions might actually exacerbate the problem of deeply nested and
therefore highly indented code.

It would be interesting to run a scan of public Clojure code to get a sense
for the average nesting level, indenting level, and the average line
width.  I'd be curious as to how far off the norm my own code is, and how
Clojure compares to other languages.

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