Free syntax idea: implement the common notation of an overline meaning "repeated some number of times" by writing underscores in the line above
Conversation
Have you seen Racket and Coq's ... instead? I find the actual syntax rules more mysterious than Scala's underscore, but it's basically magic! (And a syntax for folds, really).
3
3
I haven't. (Is that what C++'s variadics were inspired by?)
1
I dunno, I’m guessing it would be more likely to just be the maths notation, but I dunno. From what I’ve seen the C++ folks are pretty bad at citing their sources :/
1
C++'s ... is just Java's, I think?
Instead, Racket's ... and Coq .. is a DSL for fold macros! It lets you write this (from Coq):
Notation "[ x ; y ; .. ; z ]" := (cons x (cons y .. (cons z nil) ..)).
(from coq.inria.fr/library/Coq.Li).
2
1
But I last looked at Racket's ages ago, but I expect Racket will have sane(r) docs and semantics (just because, y'know, Racket's *actually* been designed).
Hardcoding base cases of fold in a language spec? Dear lord. Have they already decided to allow overloading all of those literals???
Let me say sth positive: I feared they'd just do reduce and then crash on empty lists, so this isn't the worst imaginable thing.
1
I have a non-zero reputation for tolerance on languages. And I'm sure they have their motivations.
But that rep's built by not looking at C++! :-P
1
Show replies


