[Haskell-beginners] The (x:xs) in function parameter is a tuple?

Rein Henrichs rein.henrichs at gmail.com
Wed Feb 24 18:24:06 UTC 2016


A tuple can have any number of elements. (1,2) is a 2-tuple. (1,2,3) is a
3-tuple. (x:xs) and (x,y) are differently typed: xs must be a list of the
type of x, while y can be any type. (x:xs) is not a tuple. It is a list by
definition.

On Wed, Feb 24, 2016 at 2:45 AM Imants Cekusins <imantc at gmail.com> wrote:

> Hello Xiao,
>
> (one_element)             -- is evaluation
> (element,element,...)    -- is tuple
>
> (1:[2])     -- [1,2] because it is one "array element"
> (1,2)      -- is a tuple because there are 2 elements
> _______________________________________________
> 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/88384c44/attachment.html>


More information about the Beginners mailing list