[Haskell-cafe] Prolog-style list syntax?
anthony.d.clayden at gmail.com
Tue Jun 29 11:01:29 UTC 2021
On Mon, 28 Jun 2021 at 23:20, Johannes Waldmann <
johannes.waldmann at htwk-leipzig.de> wrote:
> > `[ x, y, z | zs ]` is also valid; [...]
> > That structure is particularly ugly in Haskell syntax.
> how so? `x : y : z : zs`
Because almost always you need to put parens round -- certainly in a
And it's not square brackets, which would say 'here comes a list'.
> Prolog list syntax is ugly here because
> the "cons" operator (|) needs special parentheses.
Exactly! Special list-heralding brackets.
> Well, a similar thing in Haskell ist the ".."
> (enumFromTo) operator.
@Jeff But I actually like this the best:
> [x, y, z, zs...] = list
> [x, y, z, zs at ..] = list
Could be an as-pattern binding to the tail. But now it's getting
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe