<div dir="ltr">(:) is a constructor. For example, you can define lists as:<div><br></div><div>data List a = Nil | Cons a (List a)</div><div><br></div><div>GHC does some magic to provide us with the same definition, but with Nil replaced by [] and Cons replaced by (:).</div><div><br></div><div>As constructors can be pattern matched on, you can also match on a (:), which is a data constructor.</div><div><br></div><div>You might consider (x:xs) as a tuple, only if you're willing to consider (Cons x xs) as a tuple. It is a tuple (ordered collection of two values), but not a tuple according to their definition in haskell.</div><div>What kind of tuple are you talking about?</div><div><br></div><div>Hope this helps.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px"><span style="font-size:12.8px">Regards,</span></div><div style="font-size:12.8px"><span style="font-size:12.8px"> Sumit</span></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On 24 February 2016 at 16:01, Nan Xiao <span dir="ltr"><<a href="mailto:xiaonan830818@gmail.com" target="_blank">xiaonan830818@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
Greetings from me!<br>
<br>
I am confused about the function parameters and tuple. E.g.:<br>
<br>
occurs value [] = 0<br>
occurs value (x:xs) = (if value == x then 1 else 0) + occurs value xs<br>
<br>
should we consider (x:xs) as a tuple?<br>
<br>
Thanks in advance!<br>
<br>
Best Regards<br>
<span class="HOEnZb"><font color="#888888">Nan Xiao<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</font></span></blockquote></div><br></div>