Improve error handling
This commit is contained in:
parent
2fa1204d82
commit
9b566f2a63
@ -30,6 +30,7 @@ lowestYC (a:b:vs)
|
|||||||
-- P0 and the x-axis.
|
-- P0 and the x-axis.
|
||||||
grahamSort :: [PT] -- ^ the points to sort
|
grahamSort :: [PT] -- ^ the points to sort
|
||||||
-> [PT] -- ^ sorted points
|
-> [PT] -- ^ sorted points
|
||||||
|
grahamSort [] = []
|
||||||
grahamSort xs = p0 : sortBy (\a b
|
grahamSort xs = p0 : sortBy (\a b
|
||||||
-> noEqual a b .
|
-> noEqual a b .
|
||||||
compare
|
compare
|
||||||
@ -59,7 +60,6 @@ grahamSort xs = p0 : sortBy (\a b
|
|||||||
grahamGetCH :: [PT] -> [PT]
|
grahamGetCH :: [PT] -> [PT]
|
||||||
grahamGetCH vs = f . grahamSort $ vs
|
grahamGetCH vs = f . grahamSort $ vs
|
||||||
where
|
where
|
||||||
f [] = []
|
|
||||||
f (x:y:z:xs)
|
f (x:y:z:xs)
|
||||||
| ccw x y z = x : f (y:z:xs)
|
| ccw x y z = x : f (y:z:xs)
|
||||||
| otherwise = f (x:z:xs)
|
| otherwise = f (x:z:xs)
|
||||||
|
Loading…
Reference in New Issue
Block a user