8 ms·
I'm a Lisper (and Pythoner) and strongly agree, the first one is not readable. I would say it's gross. It boggles my mind that Lispers haven't taken that proble
by breck 9y ago
I'm a Lisper (and Pythoner) and strongly agree, the first one is not readable. I would say it's gross. It boggles my mind that Lispers haven't taken that problem seriously. I have taken it very seriously and have been working on it for years.
I just started publishing my results.
http://breckyunits.com/the-flaw-in-lisp.html http://breckyunits.com/the-flaw-in-lisp.html
What I've discovered is that the parentheses are completely unnecessary in Lisp, and in fact cause much harm by making Lisp harder to read and maintain in the long run. Drop the parentheses in Lisp by switching to whitespace/geometry for syntactic structure and you suddenly have the dream language.
Your example above would be something like:
setv result
-
/
+ 1 3 88
2
8
You might think that looks a little strange too at first, but the neat thing about that code is you can write it on a piece of graph paper, draw lines around each word, connect the indented nodes, and you'd have a tree visualization of your syntax code without doing a single transformation of the source.
- anaphor 9y agoThe problem is that it requires all of your functions to have a fixed arity I think, or at least a lower bound on the arity, or you use newlines as part of the syntax. Check out this https://shriram.github.io/p4p/ https://shriram.github.io/p4p/
- breck 9y agoVery interesting link, thanks for sharing. I'm always eager to see developments in the Racket world. > The problem is that it requires all of your functions to have a fixed arity I think, or at least a lower bound on the arity, or you use newlines as part of the syntax. This was my initial thought as well. However, in my latest batch of ETNs (the name I give to these types of lisps), I've found that a simple convention of putting any variadic argument last seems to work well. An example may help. Here would be a language blueprint that defines 2 node types: =+2 description Adds two numbers pattern resultIdentifier number number =+ description A variadic adder of unknown arity pattern resultIdentifier number+ Here's a sample program in the language we partially defined above: =+2 sum 2 5 print sum # prints 7 =+ sum 1 2 4 print sum # prints 7
- kod 9y agoYeah, whitespace sensitive languages are a great idea... Until you permanently lose user data because of a pull request that contained whitespace changes. Yes, I've seen this happen in production, yes it could have been prevented in other ways... but why invite disasters like that upon yourself?
- mulmen 9y agoIs that a problem with whitespace or your test/qa/release process? A curly brace language isn't any less likely to lose user data to a bug just because it has curly braces.
- kod 9y agoIt is less likely to cause problems, because a removed curly brace won't parse correctly, and won't be hidden when someone excludes whitesoace from a diff.
- pharrington 9y agoYour -if- clause sans curly braces definitely still parses.
- JadeNB 9y ago> won't be hidden when someone excludes whitesoace from a diff. Surely it is good advice not to exclude whitespace from a diff when using a whitespace-sensitive language?
- dragonwriter 9y ago> Drop the parentheses in Lisp by switching to whitespace/geometry for syntactic structure and you suddenly have the dream language. This has been “discovered” many times, but somehow this dream language never approaches even Lisp in popularity. (Though a loosely similar transformation of it's basic ML-based syntax is used in Haskell to reduce parens, but that's not a Lisp base.)
- emmelaich 9y agoe.g. http://chrisdone.com/z/ http://chrisdone.com/z/ Fascinating but I don't think it has many users! A quote from that page... (Note: there are no parentheses in Z. Zero.) Which, if you think about it, is the natural grouping for the definition of the name argument syntax I gave above. To pass additional arguments to a function, the arguments are put on the next line and indented to the column of the first argument:
- breck 9y agoI love Z but think there are a few details that are off. 1. A single space for indenting nodes works much better. 2. strings don't need quotes.
- breck 9y ago> This has been “discovered” many times, So far I'm only aware of one previous discovery--https://srfi.schemers.org/srfi-49/srfi-49.html-- https://srfi.schemers.org/srfi-49/srfi-49.html--, which nsajko pointed me to a couple weeks ago, (https://news.ycombinator.com/item?id=14606595 https://news.ycombinator.com/item?id=14606595). Are you aware of other identical or near identical implementations? The tiniest details matter here. I'd be very interested in more. > but somehow this dream language never approaches even Lisp in popularity. Agreed! That's what I'm hoping to help change. It's going to be a long slog, but I'm very confident the math works out and it's going to happen. The tooling needs to be built to take advantage of the properties of these languages before they will catch on. But once that happens, I think we're in for a whole new world in programming.
- 9y ago
- deleted 9y ago[deleted]
- blain_the_train 9y agoTake a look an Parinfer https://shaunlebron.github.io/parinfer/ https://shaunlebron.github.io/parinfer/. Which essential makes clojure a whitespace language with indent mode.
- breck 9y agoSuper interesting. I wonder if the creator has considered just not having parens at all?
- blain_the_train 9y agoI have had the same thought. I'm guessing, given how long lisp has been around. That the ideas is well research.
- undershirt 9y agoI have! I think and so have others: - http://nonelang.readthedocs.io/en/latest/dataformat.html#naked-coated-expressions http://nonelang.readthedocs.io/en/latest/dataformat.html#nak... - http://readable.sourceforge.net/ http://readable.sourceforge.net/ - https://github.com/boxed/indent-clj https://github.com/boxed/indent-clj
- breck 9y agoInteresting, I should have been clearer when I said not just no parens, but also just whitespace instead of any syntax characters. The none language uses both () and "". Sweet expressions use {}. And indent-clj uses () and [].
- gnaritas 9y ago> by switching to whitespace/geometry for syntactic structure and you suddenly have the dream language. Nope, you've just made it awful, white-space with syntactic meaning is just god-awful. It's the worse thing about Python, there's a reason it's not a more popular language feature.
- breck 9y agoI actually agree. Unless done perfectly, whitespace with syntactic meaning languages are quite annoying. If I had a nickel for every time I had a tab vs space bug in Python when I was first starting to code.
- kirbyfan64sos 9y agoWell, now Python 3 doesn't allow tabs anyway. ;)
- breck 9y agoI got it excited when I read your comment, but turns out it still allows tabs, just not mixing. :(
- gnaritas 9y ago> by switching to whitespace/geometry for syntactic structure and you suddenly have the dream language. Nope, you've just made it awful, white-space with syntactic meaning is just god-awful. It's the worse thing about Python, there's a reason it's not a more popular language feature.
- amelius 9y agoI'm using this same approach in a side project. The idea is very old. See e.g. [1] and the references therein. [1] https://srfi.schemers.org/srfi-119/srfi-119.html https://srfi.schemers.org/srfi-119/srfi-119.html
- breck 9y agoVery cool! Is wisp yours? I learned of SRFI 49 just over a month ago. I reached out to Egil and hope will be able to chat with him this summer. As 110 and 119 also note, Egil was on to something. Although I came to it from a different angle, I think he had it about 90% correct. My contribution is identifying the split between TN and ETNs, and then getting the details perfect with TN. Getting the details perfect meant showing how to craft it so that every single input was a valid TN program. My motivation was, if you can write it/build it in real physical life (3D world), or in other words, if nature allows it, then why shouldn't your compiler? I think 49 missed a few tiny details (like " It is an error if neither one of the leading space/tab seqquences are a prefix of the other, nor are they "...in my TN, there are no errors, and extra spaces are translated into separators for empty words).
- flavio81 9y ago>I'm a Lisper (and Pythoner) (...) It boggles my mind that Lispers haven't taken that problem seriously. I have taken it very seriously and have been working on it for years. I just started publishing my results. http://breckyunits.com/the-flaw-in-lisp.html http://breckyunits.com/the-flaw-in-lisp.html Honestly, there is no flaw in the parentheses. You just need to write more Lisp. The parentheses are one of the best things in Lisp.
- breck 9y agoDisagree. The parens are a missed opportunity. If you use geometry instead, you gain extraordinary new powers of analyzing and editing large programs in 2 and 3 dimensions. Not possible with the parens. The benefits still are not obvious but we're working on publishing more data and tools