A more serious answer is that when I code in Java I use the brace-on-a-line kind of indentation. When I code in Lisp I never write single-line parens of any kind.
I find that I think differently in each language. My Java code is always a pile of declare-this, do-this, do-this, return Thus I find that I'm delimiting the scope of my variables, marking my control flow and branching logic, try/catch logic, class boundaries, etc. My Lisp code mixes control flow and data structures in the same syntax. Thus the idea that parens are some kind of control flow delimiter is not particularly meaningful. To see the alternative case, take a Java program, find every function call such as: MyFactory(somearg); throw away the ';', and move the paren left to get: (MyFactory somearg) Now the question you're asking is, why don't lispers write (MyFactory somearg ) which makes me cringe. A second reason is that Lisp allows you to think things that Java does not. Java has this imperative, object-oriented, hierarchical style of writing. My lisp code sytle varies to fit the problem. Sometimes it is imperative, sometimes functional, sometimes OO, sometimes snobol-like pattern matching, sometimes class-based. Occasionally I dynamically construct the code and execute it inline. Or I use macros to create my own problem language and code in that. And I create my data structures "on the fly" inline to the code. Once you really internalize lisp there are no real constraints on what you think or write. Thus there is no question of "bracing style" that is meaningful. The whole idea of "bracing style" is Java-think. Your language choice has given you an OO-procedural mindset. So when you reach for Lisp you want to see what you have come to expect. People who work with bricks (Java) tend to wonder why they don't find bricks among people who work with modelling clay (Lisp). The answer isn't in the material, it is in your mindset. Just by looking at lisp code I can tell what your native language is. Fortran programmers simulate COMMON blocks, C programmers use things as pointers, etc. "You can write Fortran in any language" is a famous quote but "you can't write Lisp in any language". And you can quote me on that. (But only in my obituary :-) ) In fact, I think that this is going to be the hardest barrier to the adoption of Clojure. "Real Java Programmers" are not going to like the bracing style (or lack thereof) in Clojure. Tim Daly Greg wrote:
It's almost purely community convention that has been adopted from Lisp. You may be interested in this link: http://gregslepak.posterous.com/on-lisps-readability There is much discussion about this topic there. Cheers, Greg On Aug 18, 2010, at 2:09 AM, michele wrote:Wouldn't that make it easier to keep track of them. Example: (defn myfn-a [a b] (if (zero? b) a (recur (afn (bfn (...)) a) (dec b)))) (defn myfn-b [a b] (if (zero? b) a (recur (afn (bfn (...)) a) (dec b) ) ) ) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
-- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
