wangzx wrote: > (defn hello > "Writes hello message to *out*. Calls you by username. > Knows if you have been here before." > [username] > (dosync > (let [past-visitor (@visitors username)] > (if past-visitor > (str "Welcome back, " username) > (do > (alter visitors conj username) > (str "Hello, " username) ) ) ) ) ) > > The code is copied from book "Programming Clojure", I think the ) is > too much for reading. So, can we using the following style: > > defn hello [username] > dosync > let [past-visitor (@visitors username)] > if past-visitor > str "welcome back, " username > do > alter visitors conj username > str "Hello, " username > > The line indent contains the parenthesis and it looks it is much > friendly for ready. > > I think clojure may mix both the parenthese and python-like indent > together.
It's easy to say, but try imagining how macros will be written when there are no parentheses. I think the parentheses help a lot in lending homoiconicity to Clojure and other Lisps. Moreover, when you use a decent Lisp-aware editor parentheses usually vanish in thin air. All you care about then is the indentation. Regards, BG -- Baishampayan Ghose <b.gh...@ocricket.com> oCricket.com
signature.asc
Description: OpenPGP digital signature