Below is a snippet from Rich's presentation at QCon 2009 (http://
qconlondon.com/london-2009/file?path=/qcon-london-2009/slides/
RichHickey_Clojure.pdf):

(reduce (fn [model f] (assoc model f (inc (get model f 1))))
        {} features))

Do Clojurians usually arrange like that? Can it be rearrange for more
understandability?

Thanks


On Dec 12, 5:16 am, ataggart <alex.tagg...@gmail.com> wrote:
> On Dec 11, 1:14 am, ngocdaothanh <ngocdaoth...@gmail.com> wrote:
>
>
>
> > > Do you come from a Python background?
>
> > For the sake of this discussion, I would say I come from Erlang.
>
> > > Judging by you examples, I looks like you're still getting used to the 
> > > lisp style of coding.  Everything is a chained function call.
>
> > You're correct. Comming from Erlang:
> > * I tend to see things as if they are in a chain, concatted by commas.
> > * I feel that I have to write lots of nested "let"s for temporary
> > immutables. I think to avoid adding "let"s, Clojurians would just
> > don't use temporary immutables. This makes Clojure code hard to
> > understand, because temporary immutables with good names help explain
> > the code. The tricks to avoid adding "let"s in previous posts are very
> > ugly in my opinion. Is this style of "let" common and a good practice
> > to follow? (I just want to know, sorry if my expression is offensive)
>
> > > What do you mean by abstractness?
>
> > By "abstractness level" in the previous post, I mean level of code
> > block. For example I would say B1 and B4 are of the same level.
>
> > B1
> > | B2
> > | B3
> > B4
>
> > Because of indents, my previous Clojure code lied to my eyes that x,
> > y, f, g are not at the same block level. This is my difficulty with
> > Clojure. In short, I can't see a rough algorithm from any Clojure code
> > any more just by seeing the shape (levels) of blocks. To understand a
> > Clojure code, I have to look at every bit of code, look closer.
>
> > > In Clojure we still need to look farther up the screen...
>
> > Things in Erlang are immutable, so I think Clojure has no advantage
> > over Erlang here.
>
> > > Practice using comp & partial...
>
> > What do you mean by "comp & partial"? Could you please explain?
>
> > > (let [x 1
> > >       y (+ x 2)]
> > >   (f x)
> > >   (g y))
>
> > Well, I know my example code can be rewritten like that, but I just
> > could not give a better one.
>
> > Rearranging like this reminds me of C, in which every variables must
> > be listed beforehand. Since all Clojurians say "lazy" is good, I would
> > say I prefer C++ because I can be lazy in it, I only have to declare a
> > variable when I actually use it.
>
> > I'm lost in Clojure, please light me a way.
>
> > Lots of thanks.
>
> It would be much easier if you pasted some real code.  So far it just
> looks like complaining that you find it awkward to write clojure in an
> imperative style.

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