[Haskell-beginners] [x] and (x:_) for lists -- did you ever think that odd?
AntC
anthony_clayden at clear.net.nz
Tue May 22 02:36:47 CEST 2012
Brandon Allbery <allbery.b <at> gmail.com> writes:
> You missed experienced Lispers, who are likewise entirely comfortable with
cons-like notation.
Good point Brandon, I should have asked what background and expectations
people were coming from. From ALGOL, square brackets mean arrays, which are
close-ish to lists(?)
(For Lispers: does it seem odd using colon? Does it seem odd that dot is
function composition, not cons pairing?)
I was more getting at the oddness (or perhaps not) of having two different
notations.
>
> I would want to very carefully check the implications of your suggestion:
No, I wasn't anywhere near making a "suggestion" or "proposal". Just asking
for people's impressions.
> it might not integrate well with the rest of pattern matching syntax, ...
FWIW, the double-dot notation is not currently valid in a pattern.
I wanted to show something with square brackets. And to my mind, the double-
dot could be taken as an unknown-length tail of the list, like an ellipsis.
But others (it seems) think of it as enumFrom.
AntC
More information about the Beginners
mailing list