I need to calculate the minimum of a list but im trying to do it on this Type declaration
Ord a => a ‐> [a] ‐> [a]
which computes the list of those elements of the given list which are smaller than a
given argument (first argument of the function)
mymin :: Ord a => a-> [a] -> [a]
mymin (x:y:xs)
| x > y : mymin(y,xs)
|otherwise
Just use filter
. It was made for filtering lists:
mymin :: Ord a => a -> [a] -> [a]
mymin x = filter (< x)