Arc Forumnew | comments | leaders | submitlogin
Parendown, a syntax like Arc's a:b for Racket (
5 points by rocketnia 1634 days ago | 5 comments

4 points by zck 1633 days ago | link

Interesting! My first reaction is that I would very much dislike reading code with this (I've never gotten used to Arc's`(a:b c)` syntax).

But it's cool to cross-pollinate languages!


4 points by rocketnia 1633 days ago | link

I understand, I think. I think it adds regularity, which is a benefit and drawback, like it is with Lisp's parentheses. But I got used to Arc's (a:b c) at a time when I didn't need a strong reason; the fact that someone put it in a language was enough to convince me it was worth a try, and by "try" I mean using it everywhere I could. :)

This Parendown syntax tackles the a lot of the same needs as quotation sugars, right-associative infix operators, multi-branch conditionals, and imperative blocks. Those individualized pleasantries no longer need to exist as much, but some of what was pleasant about them might slip through the cracks and be neglected entirely by the more regulated approach. Lisp's parentheses didn't solve the things this does, and this doesn't solve some things that other syntaxes do (such as left-associative infix operators, perhaps).

Programming this way in Cene for a while, one thing I keep wanting to reintroduce is quotation sugar. But that's probably unrelated; Cene has a more elaborate syntax for quotation to help with programs that involve several nested quotes, and since I only actually use it in shallow cases, it's a bit hard to explain why I've made it so elaborate. :-p A sugar would brush some of that complexity under the rug until it's useful.


4 points by prestonbriggs 1622 days ago | link

I quite like ':' for function composition, especially in situations like this

  (map odd:car '((1 2) (4 5) (7 9)))
where you're composing a new function to pass along as an argument.


3 points by rocketnia 1621 days ago | link

Well, that's a use case Arc supports and Parendown doesn't. :)

Depending on the example, Parendown can get close:

  (map odd #/map car '#/(1 2) (4 5) (7 9))


3 points by rocketnia 1634 days ago | link

I developed Parendown over the last couple of days as my first foray into Racket #lang extension.

This is a syntactic feature I've had in the Era languages for a long time, and it has such a drastic effect on the language's appearance that I always feel like I need to go out of my way to explain it. It's just a simple s-expression sugar inspired by Arc's a:b ssyntax, but it's so handy.