3 ms·
Not with proper indenting, or rainbow-delimiters/show-paren-mode.
by lvass 4y ago
Not with proper indenting, or rainbow-delimiters/show-paren-mode.
- Jensson 4y agoI don't buy that, when you do the same in other languages you get: for (var i = 1; i < 101; i++) { if (i % 15 == 0) { console.log("FizzBuzz");} else if (i % 3 == 0) { console.log("Fizz");} else if (i % 5 == 0) { console.log("Buzz");} else { console.log(i);}} Why do you think nobody other than lispers writes code like this? Is it really necessary to write code that way? If it is better, why not does nobody else do it? They can also use colored bracers and tooling, while lispers has written code that way forever. I'm sure a big reason people call lisp a "write only language" is because of this strange convention of stacking all parentheses in a big clump instead of formatting like normal.
- aGHz 4y agoDo you want Python? Because this is how you get Python. Joke aside, this is why I never understood this problem. With proper indentation it looks essentially like Python with a generous helping of your-father's-parentheses.
- na85 4y agoI used to feel the same way but lisp gets easier to read with practice, and unless you're writing code in notepad.exe or nano or something, your editor will show you the matching paren.
- lvass 4y agoIMO, because C syntax sucks and makes people actually take time to read and interpret the brackets. In erlang and I think others people don't newline between closing delimiters either. In lisp the brain processes the parens automatically.
- wtetzner 4y agoWho calls Lisp a "write only language" other than people who don't know Lisp?
- lispm 4y agoThere is the classic Minsky quote: “Anyone could learn Lisp in one day, except that if they already knew Fortran, it would take three days.”
- lispm 4y agoYet, for Python the layout is like above, with indentation being significant: for i in range(1, 101): if i % 15 == 0: print("FizzBuzz") elif i % 3 == 0: print("Fizz") elif i % 5 == 0: print("Buzz") else: print(i) It does not need the {} pairs then. Now, are we lost because the {} pairs are missing? In Lisp you need to learn to apply the same idea of indentation being significant: (loop for i from 1 upto 100 do (cond ((zerop (mod i 15)) (write-line "FizzBuzz")) ((zerop (mod i 3)) (write-line "Fizz")) ((zerop (mod i 5)) (write-line "Buzz")) (t (write-line (princ-to-string i))))) Just imagine the grouping parentheses are not there. The disadvantages of Lisps are basically two: a) there are more parentheses because of the nested lists being used to write code b) one now needs to understand when (sin a) is actually code and when it is data. The advantage of Lisp syntax: a) code is already a simple nested data structure b) the indentation&layout of code can be (and often is) computed from the data, while usually in Python the lines and indentation are significant
- oedo 4y ago>when you do the same in other languages you get... Your result should be unsurprising. Lisps have a minimal syntax that naturally entails high levels of nesting: (s-)expressions being used to represent functions, control structures, data, etc. Why should a particular style convention appropriate for that kind of language necessarily transplant well to JavaScript-- a brace-delimited, Algol-inspired language with a lot of syntax?
- boondaburrah 4y agoIs it bad that I find that really easy to read?