Talk:Graham Scan Implementation
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Use foldr to simplify buttonLeft
The buttonLeft function can be simplified using foldr like so:
buttonLeft :: [Pt] -> Pt
buttonLeft = folrd minY (Pt (1/0, 1/0)) where
minY (Pt (ax, ay)) (Pt (bx, by))
| ay > by = Pt (bx, by)
| ay < by = Pt (ax, ay)
| ax < bx = Pt (ax, ay)
| otherwise = Pt (bx, by)