6 ms·
One one side you have people like the author who crave the power of code-as-data more than they care about nice syntax and therefore love Lisp. I crave both th
by nessus42 15y ago
One one side you have people like the author who crave the power of code-as-data more than they care about nice syntax and therefore love Lisp.
I crave both the power of code-as-data and nice syntax, which is why I love Lisp.
- calibraxis 15y agoYes, I don't see how mainstream languages can possibly be considered aesthetically pleasant, with the possible exception of Python. I wouldn't visit a gallery that shows them off. I find Lisp (particularly Clojure) much more aesthetically pleasant, in that it communicates better with me. With Paredit, it's even better to the touch. (If there one day came to exist something even better on these metrics, then I'm sure I would start to prefer it aesthetically.)
- kls 15y agoI agree I don't get the syntax argument. I am sure that as one of the other posters mentioned that one is more favored than the other, but once you know the limited syntax of a Lisp it becomes fairly readable. For me it's all about figuring out scope, once I know what denoted scope, it is fairly easy to format the code into a readable format for my mind. The thing about the Lisp dialects is the rules for syntax are so simple that once understood they become perfectly readable, at least to me they do.
- edoloughlin 15y ago> I agree I don't get the syntax argument Doubly agreed! I learned Clojure just over a year ago and will never look back. My attitude to people complaining about parents is that that should just get over it. That one hang up is actually holding them back.
- edoloughlin 15y agoThat should have been 'parens', not 'parents', of course. Although, in another context, it's completely valid!
- ebiester 15y agoI'll explain it to you: Where is the bug in.. (defun substitute-in-replacement ($-value replacement) (cond ((null $-value) replacement) ((null replacement) ()) ((eq (car replacement) '$) (cons $-value (cdr replacement))) (T (cons (car replacement)) (substitute-in-replacement $-value (cdr replacement))))) From: http://www.csc.villanova.edu/~dmatusze/resources/lisp/lisp-example.html http://www.csc.villanova.edu/~dmatusze/resources/lisp/lisp-e... with one paren moved. I remember, when I was taking a class on AI, looking for some sort of style guideline that would help me get through the learning curve, but the FAQ (I want to say it was comp.lang.lisp) just had "coming soon." So this would be the allegro editor in 2001 or 2002. It may be obvious to an experienced hand, and perhaps if there was some sort of best practices when I was learning it I wouldn't have had the same problem, but I just remember the frustration of my mind playing tricks on me and (even with syntax highlighting) trying to match parens that I thought were there.
- twstws 15y ago1 paren moved and all line breaks and indentation removed. This is intentionally obfuscated. Is there any language that is easy to read when you put five lines of code together like This? I haven't read a lisp style guide, Emacs just takes care of indentation - it is immediately clear when a paren is wrong because the shape of the function is wrong. If you are writing lisp with an editor that doesn't do this, get a better editor, don't blame the language.
- berntb 15y ago>>Is there any language that is easy to read when you put five lines of code together like This? Arguably Python -- but to get that, Python sacrificed the possibility of both usable anonymous functions and the possibility to cut-paste a code fragment and just ask the editor to reindent. Hardly worth the price.
- ebiester 15y agoOy. The mistake was actually in posting too late and not using the proper code tag. Don't drink and post, kids. ;) When I brought the code into vim I used the same indentation as the example, I saw that the indentation changed, but you're saying "The shape of the function is wrong." It's quite possible my experience as a programmer today would be different than when I started -- I mean, I made it through a few chapters of SICP without such troubles, but in the back of my head was the memory of trying to figure out my logic error in a bit of code when it was really a misplaced paren.
- haberman 15y agoSome people like putting salt on grapefruit. I'm not saying that it's impossible to like Lisp's syntax, but empirically most people prefer the ALGOL-like syntax, which is why I referred to it in the next sentence as "conventional syntax." I could attempt to prove to you that "conventional syntax" is inherently superior to Lisp syntax, but that would be a waste of both of our time.
- dman 15y agoSyntax is the vietnam of programming languages.
- anamax 15y ago> I could attempt to prove to you that "conventional syntax" is inherently superior to Lisp syntax, but that would be a waste of both of our time. Yes, trying to prove falsehoods is a waste of time. Conventional syntax is neither conventional nor suited to humans. (If it's "conventional", why isn't there more agreement as to what it is? If it's suited to humans, why aren't there more than 100 who actually know it for any given language?)
- krunaldo 15y ago(+ 1 2 3) = add 1 and 2 and 3 The syntax is a bit terse but if you teach people a good way to read it it becomes much more readable than 1+2+3 The only reason we prefer that way is that we are thought that syntax when we do math in school, I have found it much easier to teach people lisp who have no or very little formal education in math.
- Volpe 15y agoWeak arguement. So rather than form a language around our existing learnings (in Math as you say). We should change all our existing learnings to suit a particular language... then it's more readable... riiiiight, good luck with that. :)
- Confusion 15y agoThis argument is based on too shallow an analysis and doesn't stand up to closer examination. (/ (+ (- b) (sqrt (- (* b b) (* 4 a c)))) (* 2 a)) Yeah, so it divides (the addition of (-b and the (sqrt of (the difference between (the product of b and b) and (the product of 4, a and c))) by (the multiplication of 2 and a)) Right, that's much easier than (-b + sqrt(b*b - 4*a*c)) / (2*a) (-b plus the sqrt of ((b times b) - (4 times a times c))) divided by (2 times a)
- wvenable 15y agoLisp is effectively the parse tree in other languages. In the gap between human and machine, Lisp is closer to the machine. Some people like that, but the majority prefer a language that is closer to the human (and perhaps the closer you get to the human the less nice it gets depending on how you define "nice").
- anamax 15y ago> the majority prefer a language that is closer to the human Closer to "the human"? Do you know more than 3 people who know C++ operator precedence? Humans don't handle operator precedence very well.
- haberman 15y agoWhy then has math (which is read and written only by humans) used infix notation for hundreds of years, whereas prefix/postfix notation were only developed in the 20th century and today are used only by Computer Scientists? You don't have to know an entire operator precedence table to read and write idiomatic infix-notation code. Precedence is defined such that common expressions evaluate as people intuitively expect (a notable counterexample is "x & y == z" in C). Parentheses are always available to clarify more complicated expressions.
- brlewis 15y agoHumans who do a lot of math switch notations when convenient. For example, for addition we'll sometimes put a summation sign in prefix notation. For division we like to put the numerator above the denominator, a notation that's inconvenient in a programming language. Come to think of it, humans usually add and subtract by stacking numbers vertically. I don't think you can point at infix notation as "the" human-friendly notation.
- Volpe 15y agoHave you seriously seen (non-computer) people write simple arithmetic as + 1 3 ? This feels like a discussion based in fiction...