Reputation: 330
I need to find max and min elements from list and remove them and their duplicate. I use
maximum(list)
minimum(list)
to find max and min but don't know how to remove all of them from a list.
Upvotes: 1
Views: 104
Reputation: 12983
Filter will do what you need
removeMinAndMax xs =
filter (\x -> x /= listMin && x /= listMax) xs
where listMin = minimum(xs)
listMax = maximum(xs)
Upvotes: 2