'''[From LotsofIrritatingSillyParentheses]''' I'll say it again: none of this helps the poor soul who has to read LISP code on paper. ''Indentation helps. Reading obfuscated code (no matter what language) is not fun.'' But some languages make it easy to obfuscate code. In fact, in some languages it's so easy to obfuscate code that it's hard to write non-obfuscated code. LISP encourages deep nesting, which has a high obfuscation potential. Consider a procedural program with an a conditional inside another conditional inside a loop, itself inside a method definition which is inside an inner class. Already nested too deep for easy comprehension by mere mortals, but this is only four levels, and it is hard to imagine a non-trivial LISP function that would require any less. -- AnonymousDonor Whatever do you mean? Lisp exposes some sorts of nesting that aren't so visible in other languages (at least until one reaches enlightenment and the parentheses become invisible), but what's confusing isn't the number of visible nesting levels but the complexity of what's actually going on. There's no more reason in Lisp than in any other language to write "a procedural program with a conditional inside another conditional inside a loop inside a method definition inside an inner class". Which, by the way, is at least seven levels (an inner class, by definition, must be inside something else), not four. - If the mere depth of visibly nested structures makes for confusion, then I dread to think how incomprehensible HTML must be to you. HTML -> BODY -> TABLE -> TR -> TD -> EM -> text is already seven levels, and much deeper nesting is commonplace. -- GarethMcCaughan Is there something preventing you from factoring out the inner conditionals and loops into their own function? I've seen some truly horrid Lisp code too, but most of the production quality stuff (CLOCC, CormanLisp) doesn't go beyond 3 levels of nesting. MAPCAR and COND can be your friends. -- JonathanTang ''I've occasionally heard the rule that in Lisp programming, if there is a section of code within a given context which is more than three lines long, or more than three nestings deep, or appears in more than three places, then you should consider factoring it into a separate function. Would this be an example of ThingsInThrees?''' ---- '''[From EssExpressions]''' The syntax of many LispLanguage-descended ProgrammingLanguage''''''s is based on EssExpressions. Since the syntax is very regular, a paren-aware editor can automate many tasks that arise when you are EditingLispCode, like indentation. ''However, no editor can ameliorate the pain of trying to read deeply nested expressions on the printed page.'' Not that the readability of code on paper is important to that many people. Code is meant to be read on a screen! I don't understand. Could you elaborate? (In practice, you don't read Lisp code by matching parens in your head. One of the tasks a parenthesis-aware editor can automate is indentation of your code, and for correctly-indented code the parentheses become virtually invisible.) ---- I think you'll find a lot of lispers wishing other code had nice readable sexps. Without them, it's like a person who keeps on explaining all of their ideas in excruciating detail, without the ability to build "concepts." Like when people keep repeating this idiom: for (i=0; i (print (string-append (get-fname) " " (get-lname))) & even that is a pretty minor difference. The other differences are even more minor. (Aside: The commonly cited infix v. prefix is an illusion since Algol-ish languages only use infix for arithmetic, boolean expressions, & assignment. They use prefix notation for everything else. & infix notation for special cases is easily added to Lisp.) I've found it better to take a bit of time to get used to the punctuation & get on with learning & using Lisp rather than to flounder in concerns over syntax. ---- My Lisp code tends to be nested more than my code in other languages. I don't see this as much of a drawback when reading code as when editing. When I need to lift a common subexpression in Lisp, I end up doing a lot more editing than in other languages, because lifting is effectively unnesting part of the code. Perhaps a better editor (or better knowledge of how to use my editor) is the answer. It certainly seems as if lifting common subexpressions could be automated. On the reading side, I find nesting obscures tail-calls. ---- Also see EssExpressions, EditingLispCode. ---- CategoryLisp