A few things might help:

* Judging by you examples, I looks like you're still getting used to
the lisp style of coding.  Everything is a chained function call.
Write your code to support with that in mind.
* Practice using comp & partial.  Write a few small apps where you
NEVER use a let form.
* Practice using ->.  Try to write a few other other apps only using
this.
* Master the editor you're using.  Emacs has great tab support, and
will help you arrange your code accordingly.  I'm sure Vim does
something similar.  Enclojure has a netbeansy "Format my code" option
from the popup menu.

Sean

PS - Do you come from a Python background?


On Dec 10, 9:15 am, ngocdaothanh <ngocdaoth...@gmail.com> wrote:
> Hi,
>
> I want to ask about code arrangement and understandability
> (readability).
>
> Consider this "normal" code:
> x = 1
> ...
> f(x)
> ...
> y = x + 2
> ...
> g(y)
>
> x, f, y, g have the same "abstractness" level, so they are indented to
> the same level.
>
> My Clojure code:
> (let [x 1]
>   ...
>   (f x)
>   ...
>   (let [y (+ x 2)]
>     ...
>     (g y)))
>
> It is very difficult to capture the "algorithm" behind the Clojure
> code because things of the same "abstractness" level do not have the
> same indent level.
>
> How to rearrange the Clojure code for understandability?
>
> I have been studying Clojure for several months now but I could never
> "get" it. But I couldn't explain why I couldn't get it, I just didn't
> know why. But today I think I have found the reason: I think the
> problem of Clojure (and Lisp) is not parenthesis, its problem is
> indent.
>
> I think if I can "let over" this problem, I will be enlightened. Would
> you please help me?
>
> Thank you,
> Ngoc

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