5 ms·
Lisp has a readability issue, where the syntax makes the authors intent not immediately clear with all the brackets. I think it shared too many of the issues R
by Joel_Mckay 4y ago
Lisp has a readability issue, where the syntax makes the authors intent not immediately clear with all the brackets. I think it shared too many of the issues RPL and Forth had to be sustainable outside academia.
When it comes to implicit parallel code, Julia hid a lot of the gruesome details in a friendly interface similar to Octave, Matlab, and Python. However, what surprised me most of all was its math ops are often still faster on a CPU than Numpy and many native C libs.
Julia still has a long way to go with its package version compatibility, but it is slowly improving as the core implementation stabilizes.
- deleted 4y ago[deleted]
- Oreb 4y agoLike any language, Lisp has readability issues when you’re not familiar with it. You find it hard to read because it’s alien to you. To my eyes – because Lisp is what I’m used to – every non-Lisp language has readability issues. These days I do a significant amount of work in Python, Rust and Julia, and although there are things I love in all of these languages, I always miss s-expression syntax when using them.
- kazinator 4y agoInfix notation can be useful for arithmetic; as a "Lisp person" I acknowledge that. S-exps can be good for arithmetic too though. S-expressions allow n-ary operators: (+ (* 3 x y) (* a b z w) (* r s t u v)) There is a systematic way to break up large expressions across multiple lines, which helps readability. Infix doesn't have a satisfactory way to do this: (+ (* 3 x y) (* a b z w) (* r s t u v)) We see just from from the + * * * pattern that we have a sum of three products. S-exps are unambiguous. You never misread an arithmetic (or any other) S-exp due to precedence, unless it's a macro that has created precedence rules among its arguments (vanishingly rare). N-ary math functions associate left to right in Common LIsp: (+ a b c d) means we add (a b) first, then c, and d. This makes a difference when you have mixed types, which have to undergo conversions, and when you have non-associative types like floating-point. If I'm cribbing some numeric calculation to use in my code (whether that code is Lisp or not), and have examples in half a dozen languages, none of which I use, I will crib it from that one that is a Lisp dialect, just because of the vanishingly small opportunity for getting it wrong due to some ambiguity issue.
- deleted 4y ago[deleted]
- jstimpfle 4y agoThis is a comment that I like, acknowledging the obvious unsophisticated but no less reasonable objection from the bystanders, and offering them an alternate viewpoint. My reservation would be that most applications of arithmetic operators are binary and not ternary. A typical expression in one of my C programs at least has some function call, some subscript, some member access, some addition / subtraction / multiplication / division. But very few have more than one of each. Overall arithmetic is actually quite rare by itself in most code.
- whartung 4y agoMy windmill is simply I still can't think in prefix for math. It's trivial for me to write x = (-b + sqrt(b^2 + 4 * a * c)) / (2 * a). But writing (setf x (/ (+ (- b) (sqrt (+ (* 4 a c) (* b b)))) (* 2 a))). That's a mind bender. Were this my source code, I'd probably put the (* 2 a) on the next line (properly indented) so it stood out as the divisor. All that said, honestly, the physical task of writing Lisp code is just so much better than anything else. There's something satisfying closing up all of the parens. And I just love using-hyphens-for-identifiers vs CamelCase or using_underscores.
- Jach 4y agoFortunately doing infix math in CL has since the 90s been one small library include away: https://github.com/quil-lang/cmu-infix https://github.com/quil-lang/cmu-infix
- jstimpfle 4y agoThat's nice but we can all agree that it's not the same thing as a standard builtin syntax that everyone knows and is forced to use.
- reikonomusha 4y agoI think you're writing it off as not actually being valuable in practice, which I don't think is fair. Should we consider Python's NumPy as not a feature of Python because it's not a built-in library? A commenter says they prefer to write infix math. Lisp has a completely ordinary, stable, well-known, 30-year-old library to do it. Thus the commenter's concerns are largely allayed. Not having it in the standard library means people have a choice to use it or not, and it also means one can't expect all Lisp code which has infix math to use it, but it certainly does not means the commenter will be perpetually hamstrung in reading and writing complicated math formulas.
- lmm 4y agoMacros are a cure that's worse than the disease. Unless everyone agrees on which set of macros you're using, you can't trust any code to mean what it looks like it means. (And if you could agree on which set of macros you were using, or what sanity-preserving restrictions you'd put on your macros, surely you'd just build those into your language).
- Joel_Mckay 4y ago"alien to you" Nope, but I do classify lisp/scheme next to Haskell, Icon/Unicon, and snowball... as ivory-tower languages. However, you wouldn't be the first person to spend 3 years of their lives failing to prove the assertion false. Is there utility assuming everyone who doesn't share your opinion is an Alien? I find it just causes the 103rd purple proboscis to itch. ;)
- pjmlp 4y agoIt is mostly switching from print(something) to (print something). And focusing on (), instead of ()[]{}:;.
- jstimpfle 4y agoOr from foo.x to (foo-x foo) or print(a, b, c, d) to (print (a) (b) (c) (d)) I don't think it's the end of the world, but I'm pretty sure one can make solid physiological arguments why the first is a little easier to read. If it wasn't, how come math notation relies heavily on infix operators and even subscripts, superscripts and more? It's because you want to optimize notation for the frequently used stuff.
- yoro46 4y agoReally instead it's (accessor object) and (print arg-1 arg-2 ... arg-n) No idea why you suddenly converted the values a, b, c, d to full-blown forms. But of course, baby duck syndrome will prevail and Minsky's comments are painfully true to this day: "Anyone can learn it [Lisp syntax] in a day, unless they know Fortran, in which case it's three days." P.S. Making general comments about "math notation" is pretty dishonest argument. The math I studied was all commutative diagrams and blobs to represent manifolds; very little "infix operators" as far as I could tell. Mathematicians in general are flexible with notation (and definitions!) and will normally default to whatever is the loose consensus in their field :)
- wiseowise 4y ago> But of course, baby duck syndrome will prevail and Minsky's comments are painfully true to this day: "Anyone can learn it [Lisp syntax] in a day, unless they know Fortran, in which case it's three days." That’s hilarious, where did he say that?
- Jtsummers 4y agoI'm only finding the quote, no source. But here's something we can be sure he said: > The complete syntax of LISP can be learned in an hour or so; the interpreter is compact and not exceedingly complicated, and students often can answer questions about the system by reading the interpreter program itself. https://web.media.mit.edu/~minsky/papers/TuringLecture/TuringLecture.html https://web.media.mit.edu/~minsky/papers/TuringLecture/Turin...
- wiseowise 4y ago> Lisp has a readability issue, where the syntax makes the authors intent not immediately clear with all the brackets. No it doesn’t, that’s like saying that any non-English language has readability issue.
- Joel_Mckay 4y agoIts ok to disagree friend, but when 95% percent of your bugs are syntax related rather than algorithmic design... it fails the sanity check. Have a gloriously wonderful day =)
- wiseowise 4y ago> but when 95% percent of your bugs are syntax related rather than algorithmic design... it fails the sanity check. And you, of course, have study that proves it, right?
- Joel_Mckay 4y agoAnecdotes are funny this way, as the data is 100% accurate or 100% arbitrary. Enhance your calm. =)
- wiseowise 4y agoQED
- Joel_Mckay 4y agoJust google "lisp syntax error" for the hit count if you are feeling petulant. =)
- Jach 4y ago"About 1,810,000 results (0.48 seconds)" Googling "python syntax error" "About 172,000,000 results (0.46 seconds)" ???