Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sortByCoTan :: [Point] -> [Point]
- sortByCoTan [] = []
- sortByCoTan [a] = [a]
- sortByCoTan (a:as) = a : sortByFirst (sortByCoTan as) where
- sortByFirst [b] = [b]
- sortByFirst (b:c:cs)
- | (myCoTan a b)>= (myCoTan ac) = b : sortByFirst (c:cs)
- | otherwise = c : sortByFirst (b:cs)
- where
- myCoTan :: Point -> Point -> Double
- myCoTan p1 p2 = (pointXval p2 - pointXval p1) /
- (pointYval p2 - pointYval p1)
Add Comment
Please, Sign In to add comment