
Thanks Richard, see the discussion last month (same Subject line) that
considered/rejected various ideas
On Fri, 9 Jul 2021 at 00:05, Richard O'Keefe
I note that (1) Clean uses ":" in lists the way Prolog uses "|".
Yeah that's where I started. [x : xs] is already valid Haskell, meaning [ (x: xs) ].
(2) Before Prolog switched to "|", Edinburgh Prolog used ",.." (two tokens).
Haskell already has [1, 2 .. 5] for arithmetic sequences. `,..` Wouldn't quite be ambiguous, but is dangerously close. (3) There doesn't seem to be any reason why [p1,p2,p3]++pr could not be
a pattern, where p1, p2, p3 match elements and pr the rest.
Oh but `++` is an operator, not a constructor. Syntactically that's not a pattern. So [p1, p2]++pr++pq is a valid expression; what would it mean as a pattern? Somebody in last month's discussion wanted similar, especially for strings "prefix"++pr. But it would be valid in a pattern only if the lhs were a pattern, and we made a special syntactic case for ++. Then what if there's a user-defined override for ++? Also see my OP last month, I want the list to be the thing in [ ], not also some trailing expression.
Erlang has <string literal> ++ <pattern>, but forbids <list pattern> ++ <pattern>, presumably because it uses "|" like Prolog.