
9 Sep
2008
9 Sep
'08
1:37 a.m.
abs (Pt {pointx = x, pointy = y}) = sqrt (x*x + y+y)
Why is it pointx=x and not x=pointx?
Your intuition is probably telling you that this is something like: abs (point) = sqrt (x*x+y*y) where {x=pointx point ; y=pointy point} Actually, it's an example of pattern matching: abs (Pt {pointx=3 , pointy=4}) = 5 abs (Pt {pointx=3 , pointy=y}) = sqrt (9+y*y) abs (Pt {pointx=z , pointy=z}) = (sqrt 2)*z etc. Best, MaurĂcio