disco icon indicating copy to clipboard operation
disco copied to clipboard

Allow optional commas around ellipsis

Open byorgey opened this issue 2 years ago • 0 comments

It is actually common in mathematics to use commas or other separators around ellipses, e.g. ${1, 2, \dots, 10}$. So it is unfortunate that Disco currently rejects this, requiring no commas around the ellipsis, as in Haskell:

Disco> {1, 2 ... 10}
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Disco> {1, 2, ..., 10}
1:8:
  |
1 | {1, 2, ..., 10}
  |        ^^^^^^^^
unexpected "..., 10}"
expecting expression

I feel like it should not be too difficult to relax the syntax to allow this (and perhaps even change pretty-printing to match), though I have not thought it through very carefully. There may be lurking ambiguity issues I'm not thinking of.

Note, if we change this, we need to make sure to update the reference documentation to match.

byorgey avatar May 23 '22 21:05 byorgey