(I have a subtle optimization for S-expression syntax)(I am surprised nobody ever thought of it)(When S-expressions are in a sequence use an extra (special) delimiter plus the regular token separator to separate expressions)(Maybe use dot? (period I think some call it))
Like so. I think it could catch on. And you get rid of so many round bracket block delimiters (at least for S-expressions on the same level. for nesting you obviously need them) that it makes reading a lot easier. Also make the language modal and have the default be the indicative mood. Maybe replace "." with "?" for interrogative mood? Maybe elide ".)" to ")" as another optimization?
(define-record-type omap-entry
make-omap-entry key item next prev.
omap-entry?,
key omap-entry-key set-omap-entry-key!.
item omap-entry-item set-omap-entry-item!.
next omap-entry-next set-omap-entry-next!.
prev omap-entry-prev set-omap-entry-prev!)
(To mark `omap-entry?` as being a value, not the S-expression `(omap-entry?)`, I decided to place a comma after it instead of a period. The alternative is requiring no punctuation and making newlines significant.)
Well, I suppose it does look better.
However, the idea is of limited applicability. While looking through the example project (https://github.com/axch/test-manager), I had trouble finding some code where this would actually be useful – most code has too much nesting.
That’s why I prefer another solution for removing excess parens from Lisp syntax: making whitespace significant. It improves the syntax in cases where your periods would help, and it applies in additional cases as well.
“Sweet-expressions” (http://readable.sourceforge.net/) is an implementation of that. Here is the above code ran through the `sweeten` tool to convert it to sweet-expressions:
define-record-type
omap-entry
make-omap-entry key item next prev
omap-entry?
key omap-entry-key set-omap-entry-key!
item omap-entry-item set-omap-entry-item!
next omap-entry-next set-omap-entry-next!
prev omap-entry-prev set-omap-entry-prev!
Absolutely no parentheses necessary, while still preserving homoiconicity. You don’t even have to remember the `)` at the end of the last nested line. And I chose this example code to look good with your idea – when the code has more nesting, sweet-expressions look even better.
About the interrogative mood `?` you describe: it might simplify `if` statements. But that would require removing the convention where boolean-returning functions have a name ending in `?`, such as `omap-entry?` in the example. It’s a tradeoff.
Sweet-expressions is a cool idea. Was it Python that started the whitespace-is-significant trend? I'm wondering why someone doesn't create a Scheme or a Lisp with this as valid syntax out of the box. I think you'd still need to support regular S-expressions though, right?
Like so. I think it could catch on. And you get rid of so many round bracket block delimiters (at least for S-expressions on the same level. for nesting you obviously need them) that it makes reading a lot easier. Also make the language modal and have the default be the indicative mood. Maybe replace "." with "?" for interrogative mood? Maybe elide ".)" to ")" as another optimization?