<div dir="ltr">Hi Jared & Imants,<div>Thank you for your responses. Makes sense.</div><div><br></div><div>Best,</div><div>Santosh</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 9, 2014 at 2:18 PM, Jared Kofron <span dir="ltr"><<a href="mailto:jared.kofron@gmail.com" target="_blank">jared.kofron@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 Santosh,<br><br>No, you can't pattern match on the head of a tuple, because a tuple doesn't have a head in the same sense that a list does. <div><br></div><div>The size of the tuple is part of its type - {A,B,C} is of type {any(), any(), any()}, whereas [A,B,C] has type [any()]. If I remove the first element of [any()], I get something of type [any()], whereas if I remove the first element of {any(), any()}, it's of type {any()}. </div><div><br></div><div>So there's no cons operator for tuples in the same way that there is for lists, because adding/removing some element of a tuple actually changes its type. </div><div><br></div><div>That's how I think of it, anyhow. </div><br><div class="gmail_quote"><div><div class="h5">On Tue Dec 09 2014 at 11:04:32 AM Imants Cekusins <<a href="mailto:imantc@gmail.com" target="_blank">imantc@gmail.com</a>> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">Hi Santosh,<br>
<br>
element(1,{a,b,c}).<br>
returns a<br>
<br>
<a href="http://www.erlang.org/doc/reference_manual/data_types.html#id64155" target="_blank">http://www.erlang.org/doc/<u></u>reference_manual/data_types.<u></u>html#id64155</a><br></div></div>
______________________________<u></u>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
</blockquote></div>
</blockquote></div><br></div>