<div dir="ltr">Thanks.<br><br>Pattern matching and memory management in Haskell (or may be GHC implementation of it) is somewhat of a mystery to me.&nbsp; Are there any references that explains the underlying implementation?<br>
<br>Daryoush<br><br><div class="gmail_quote">On Mon, Sep 8, 2008 at 6:37 PM, Mauricio <span dir="ltr">&lt;<a href="mailto:briqueabraque@yahoo.com">briqueabraque@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
 &nbsp; &nbsp;abs (Pt {pointx = x, pointy = y}) = sqrt (x*x + y+y) <br>
<br>
Why is it pointx=x and not x=pointx?<br>
<br>
</blockquote>
<br></div>
Your intuition is probably telling you that this<br>
is something like:<br>
<br>
abs (point) = sqrt (x*x+y*y)<br>
 &nbsp;where {x=pointx point ; y=pointy point}<br>
<br>
Actually, it&#39;s an example of pattern matching:<br>
<br>
abs (Pt {pointx=3 , pointy=4}) = 5<br>
abs (Pt {pointx=3 , pointy=y}) = sqrt (9+y*y)<br>
abs (Pt {pointx=z , pointy=z}) = (sqrt 2)*z<br>
<br>
etc.<br>
<br>
Best,<br>
Maurício<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Daryoush<br><br>Weblog: <a href="http://perlustration.blogspot.com/">http://perlustration.blogspot.com/</a><br>
</div>