PPaste!

Home - All the pastes - Authored by Thooms

Raw version

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data Cartesian2D = Cartesian2D {
    xCoord :: Double,
    yCoord :: Double
} deriving (Eq, Show)

lowestCoord :: [Cartesian2D] -> Cartesian2D
lowestCoord  = minimumBy f
    where f a b = case (compare `on` yCoord) a b of
                    EQ -> (compare `on` xCoord) a b
                    x -> x