4 ms·
dispense with the parentheses: (eq (mul (a a)) (pow (a 2))) becomes eq mul a a pow a 2
by somewhereoutth 1y ago
dispense with the parentheses:
(eq (mul (a a)) (pow (a 2)))
becomes
eq
mul
a a
pow
a 2
- danielrico 1y agoLispython I should trademark this name.
- deleted 1y ago[deleted]
- tmtvl 1y agoThat's Wisp, I don't care for it, but people who really like to assign semantic meaning to precise counts of invisible characters may find it interesting.
- derriz 1y agoAbsolutely no counting is required at all so I think your joke falls a little flat. Our visual system has the ability to detect implied straight lines (and other simple geometric outlines) from very small clues. Therefore "seeing" the vertical lines implied by the indentation is effortless - so it's immediately obvious which elements belong to each other. Indentation is an incredibly valuable "brain" hack that manages to instantly communicate hierarchy, not something to be sneered at. We have no such innate ability to match parenthesis - determining hierarchy in a jumble of open and close parenthesis requires precise counting or, typically these days, tool/editor/IDE support.
- thaumasiotes 1y ago> Absolutely no counting is required at all so I think your joke falls a little flat. Really? How do you see the difference between "TAB" and "SPACE SPACE TAB"?
- deleted 1y ago[deleted]
- xigoi 1y agoThe solution to that is easy: do not use tabs.
- thaumasiotes 1y agoThat is not the approach taken by any system that I know of that uses semantic whitespace. Tabs are meaningful in Python and make, and in fact required in make.
- xigoi 1y agoHaskell and Nim are both indentation-sensitive languages that only allow spaces as indentation.
- derriz 1y agoThat’s a design flaw of ASCII inherited by UNICODE not an argument against using indentation to portray hierarchy. I’m sure there are alternative UNICODE characters which render almost indistinguishable from “(“ also.
- XorNot 1y agoI also don't know why this is treated as controversial either: the first thing every project does is declare a canonical code formatting aka whitespace layout and start rejecting patches which don't follow it.
- agumonkey 1y agothere's a hybrid form (sweet-expressions ? i forgot), top-level terms are parens-free eq (mul a a) (pow a 2) defun min (a b) (if (a < b) a b) IIRC the hack to support this at read time was minimal, and it made a big impact in terms of "mainstream appeal"
- em-bee 1y agothe elvish shell uses the syntax in the first example: > eq (* 3 3) (math:pow 3 2) ▶ $true (function definitions on the other hand uses smalltalk/ruby style blocks)
- marcosdumay 1y agoIMO, make some syntax element that means "each line indented from this one has one single element, unless indented further". eq : mul a a pow a 2 defun min (a b) : if (< a b) a b That means you can also have haskell-like continuations: seq : eq (mul a a) (pow a 2) eq 4 3