Question about something in Hudak's book

2002-03-12 Thread Ludovic Kuty
Hello, I have just begun reading Hudak's The Haskell School of Expression and i am wondering something about the manner he calculates the area of a polygon (made of vertices) on page 27. He wrote: area(Polygon (v1:vs)) = polyArea vs where polyArea :: [Vertex] - Float polyArea

Question about something in Hudak's book

2002-03-12 Thread Tom Pledger
Ludovic Kuty writes: : | Is it an idiom or some sort of optimization ? It's more to do with the particular algorithm for finding the area of a convex polygon. Try working through the calculation of the area of this kite. Polygon [(0, 0), (1, 0), (2, 2), (0, 1)] I think the two versions