• [deleted]
    + 1 comment

    cool, got to re-use code for the convex hull problem:

    insert :: [Point] -> Point -> [Point]
    insert vs v = case vs of
      (x:y:z:ws) -> case orientation v x y of
        Up -> insert (tail vs) v
        _ -> v : vs
      _ -> v : vs
    
    convexHull :: [Point] -> [Point]
    convexHull = foldl' insert []
    
    convex :: [Point] -> Bool
    convex xs = length xs == length (convexHull xs)
    
    concave = not . convex
    
    solve :: [Point] -> String
    solve xs
      | concave xs = "YES"
      | otherwise  = "NO"