3 ms·
Scheme has a shorthand for (cons a b) that's just (a . b), and (cons a (cons b c)) as (a b . c) Racket, a scheme-based language, extended the syntax so that an
by MathMonkeyMan 4y ago
Scheme has a shorthand for (cons a b) that's just (a . b), and (cons a (cons b c)) as (a b . c)
Racket, a scheme-based language, extended the syntax so that any symbol appearing between two periods and not at the end of a list gets moved to the head of the list, so (a . b . c) becomes (b a c), which some people use so that (a . + . b) becomes (+ a b).
The D syntax you describe is what schemes call the "threading macro," or the thrush combinator in non-macro contexts.
- soegaard 4y agoI believe the general consensus is that the double dot notation might not have been the best idea. FWIW it's mostly used for inequalities like `(a . <= . b)` which some people find easier to read than `(<= a b)`. But `<=` allows more arguments as in `(<= a b c d)` and here the double dot notation can't be used.