[Haskell-beginners] The (x:xs) in function parameter is a tuple?
Josh Barney
bayesragem at gmail.com
Thu Feb 25 04:35:02 UTC 2016
The way I learned it:
A tuple type is defined by the types inside it, so an (int,int) is not the same type as an (int, maybe(int)). With a one-tuple the type would just be (int) and that provides zero benefit.
Instead of trying to do `first (...my expression...)` to get the first element of the one tuple, it just becomes the value inside.
Sent from my iPhone
> On Feb 24, 2016, at 7:02 PM, Imants Cekusins <imantc at gmail.com> wrote:
>
> My guess is: tuple must contain 2+ elements.
>
> Try to enter (1) in ghci. It is displayed as 1
>
> Parentheses are only recognized as a tuple if there are elements separated by a comma. Otherwise an expression is assumed.
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160224/b52f7547/attachment.html>
More information about the Beginners
mailing list