In F# you can still do this, but it requires that the entire statement start at the appropriate indentation in order for the compiler to infer the closure. To make it readable you break it over lines but terminate with a semi colon to finish: it is still run as a single statement. As a C# programmer I can, and have, written long statements on one line in particular, LINQ statements lend itself to this if you use the method syntax, which I use exclusively over its query syntax form. Parens serve an important purpose with lisps, just like the semi colon does in c languages. Yes I have coded with lisp, and I know they use other syntax than just parens. ![]() I didn't suggest you implied that lisp isn't written without indentation. Heaven help you if you try to implement macros that use whitespace for grouping.Ĭriticising lisp was a mistake, and I should have already ripcorded my way out of this discussion thread already, but you make some good points, so I'll respond at my own peril: Whitespace is too easy to get wrong or to misinterpret. ![]() Using indentation as grouping is by no means "saner" than using parens. I'm not suggesting that you have to like lisp or its syntax, but to suggest that the way it is designed is "insane" is just ridiculous. The fact that you don't understand this is evidence that you haven't put in enough effort to appreciate the power of lisp-like languages. They group code and data in a very compact, clear, and easily parseable(sp?) way - a way that allows for extremely powerful manipulation of both. ^ because the parens serve a very important purpose. You really do get used to it (usually even like it) after a while (oh and many scheme's use square brackets for function arguments, etc). I think that's a good thing - they function like parens but are just distinct enough to make the underlying type more obvious.Įven so, the parens don't get in the way of scheme/lisp programmers. I thought you said you tried Clojure? Clojure's data literals use curly braces (maps, sets), square brackets (vectors) and parens (lists). ^ um, and who exactly suggested that? Certainly not me.Īnd if you think lisp style languages are generally written without tab or space indention, then you clearly haven't read much lisp code. "Only the insane write code without tab or space indentation" It was only my frustration with the limitations of C-like langauges that led me to reconsider lisps years later, and man am I ever glad I did.Īnd btw, I'm a "day-to-day developer" also. ![]() When I was in college, I had this initial reaction, and didn't even consider anything lisp-like for many years. It looks weird to them at first, because of past experience, so to some degree they are looking for a reason to write them off from the beginning. I think more than anything, people are just unwilling to accept that lisps look different than the X number of curly-bracket-style languages they are used to. If the stacks of parens at the end bother you so much, there is nothing in most lisps preventing you from indenting them on lines too: Some people freak out because they see a function in a lisp that ends with:īut they think that it is totally fine when a C-like langauge ends with: It has been my experience that, generally speaking, the combination of curly brackets, square brackets, and parens ( ) in languages with C-like syntax is at worst roughly equivalent to the number of parens in most lisp dialects. It isn't even minor hyperbole, it's just plain false. "replacing every curly bracket with 20 parenthesis (minor hyperbole)"
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |