3 ms·
There've been so many attempts at removing the parentheses from Lisp, to make it look more like C/C++/Java, or (more recently) Python, or other. FWIW, there've
by neilv 7y ago
There've been so many attempts at removing the parentheses from Lisp, to make it look more like C/C++/Java, or (more recently) Python, or other.
FWIW, there've been many attempts in Scheme (and Racket), including one by the core Racket developers (Honu [1]), but they've never taken off. New people decide to use parentheses.
There's a phenomenon with Lisps, in which, speaking loosely, half the people who first see a Lisp think the parentheses are a problem, and immediately start to propose "solutions" for "acceptance". But then they try the Lisp with the parentheses, in an editor with at least simple indenting support, and they very quickly get used to it, and maybe even value it. (A small percentage of them will still put each close-paren on its own line, for a substantially longer period, but it seems even most of them will quickly learn to snuggle close-parens and possibly to use fancier editor commands for movement and editing based on expressions rather than lines.)
Programmers seem more malleable than we might think. I'm not as sure about those mathematicians or scientists who try to minimize their time learning programming, or who are necessarily working with hairy expressions in LaTeX and don't want to have to keep translating. For possible use of those people, there are a number of efforts to permit expressions to be in more familiar infix order [2], and to support familiar TeX math notation in the Racket-based typesetting/documentation system [3]. (And if you don't like those, Racket will let programmers plug in your own reader or `#lang` to make another attempt at this atop Scheme.)
[1] https://docs.racket-lang.org/honu/Examples.html https://docs.racket-lang.org/honu/Examples.html
[2] https://docs.racket-lang.org/guide/hash-reader.html#(part._readtable) https://docs.racket-lang.org/guide/hash-reader.html#(part._r...
[3] https://docs.racket-lang.org/scribble-math/index.html https://docs.racket-lang.org/scribble-math/index.html
- singularity2001 7y ago>> There've been so many attempts at removing the parentheses from Lisp, to make it look more like C... I think it's less about looking like C (or other) it's about looking like normal Math: (f 1) vs f(1). The above plugin solves this. Maybe the neoteric feature is the most important of the three extensions. But then again `unnecessary` braces are nothing to torture malleable newcomers with, they are just a thing to get rid of.
- breck 7y agoAgreed. I don't think the attempt has been to "make it look more like C". It's been to make it better.
- neilv 7y agoThere've been so many attempts, of various stated motivations. Many of them have been expressly to make it more familiar to programmers (not mathematicians). Which, for all of the time I've been in Lisps, has meant the series of languages that mimicked the syntax of the language before, for the same familiarity/acceptance reason: C, then C++, then Java, then JavaScript. There's also been the indentation-sensitive ones that are influenced by Python. And the math ones.
- breck 7y ago> There've been so many attempts at removing the parentheses from Lisp The best previous attempt IMO was Egil Möller's I-expressions in 2003 (https://srfi.schemers.org/srfi-49/srfi-49.html https://srfi.schemers.org/srfi-49/srfi-49.html). These Sweet-Expressions in the OP I think were a regression on I-Expressions. My attempt (~2013-present) is called Tree Notation. http://treenotation.org/ http://treenotation.org/. This is the first time that we've got S-Expressions without parentheses and are using that for tremendous benefit (better concatenation, easy ad hoc parsers, visual programming and program synthesis being some of the main benefits). Here are a few sample languages: http://treenotation.org/sandbox/build/ http://treenotation.org/sandbox/build/ > but they've never taken off. It's going to happen finally with Tree Notation. We're starting to see strong network effects at last. The missing ingredient was strong tooling/design/and tools that leverage the lack of parentheses to huge benefit.
- singularity2001 7y agoBeautiful. OP claims to be backwards compatible with Clisp, that's not a goal of yours, right? So a list in treenotation would be written: list a 1 2 3 4 ? Could become a bit verbose at times, or does treenotation have a mechanism for tables like data={ header:['brand','make','price], rows:[ ['mercedes','X1',1000] , ['porsche','Z7',2000], ] } are triples always parsed like this: ? description A package (description (A package)) vs ((description A) package) Does treenotation differentiate between strings and data/ints?
- breck 7y ago> OP claims to be backwards compatible with Clisp, that's not a goal of yours, right? Correct, not a goal of mine. If someone wanted to create a Tree Language that compiles to CLisp, they could define it in our Grammar Language (http://treenotation.org/sandbox/build/ http://treenotation.org/sandbox/build/ -- you write your grammar on the left, and source code in your new language on the right). > So a list in treenotation would be written: list a 1 2 3 4 The base spec for Tree Notation is very simple. YI = "\n" // New lines separate nodes XI = " " // Increasing indent to denote parent/child relationship interface TreeNode { parent: &TreeNode children: TreeNode[] line: string } In practice, we generally break "line" into "words: string[]". So you can represent atoms in a list as either words or nodes, depending on how you design your Tree Language. > Could become a bit verbose at times, or does treenotation have a mechanism for tables like Sort of. We have a software coming out called TreeBase that is a plain text, git backed database that stores records in Tree Notation. In there we have Tree Languages for dealing with SSV/TSV/CSV/etc tables. I'm not 100% happy with the current implementation--going to be putting pattern matching into our Tree Grammar Language which might solve it--but I bet within a month or two we'll have a great solution for that with strong type checking, etc. > Does treenotation differentiate between strings and data/ints? The base Tree notation is very simple, as the spec above shows. But we created a Tree Language, built upon Tree Notation, wherein you write grammars to create new languages. In those grammar files you can define ints, strings, arrays, etc. The link above has examples with all of those.
- swlkr 7y agoMore recently, there's also parinfer (https://shaunlebron.github.io/parinfer/ https://shaunlebron.github.io/parinfer/)
- voxl 7y agoYou're ignoring the vastly larger group of developers, of which I am one, that simply refuses to program in lisp specifically because of the parenthesis hell.