articles
articles copied to clipboard
zipWith question: Correctness of optimized Polygon Eq
This is a question about your zipWith article.
You conclude your article by saying that this is a more efficient implementation of Eq for Polygon.
(==) :: Polygon -> Polygon -> Bool
Polygon p1Edges@(edge1:_) == Polygon p2Edges
= let p2Edges' = rotateUntil (== edge1) p2Edges
in p1Edges == p2Edges'
I am not convinced. If the polygons have nothing in common, then I expect rotateUntil executes forever.
Am I correct?