Question: -Define the following functions in Haskell and test them: 1)Define a Haskell function removeFirst :: (a -> Bool) -> [a] -> [a} so that removeFirst
-Define the following functions in Haskell and test them:
1)Define a Haskell function
removeFirst :: (a -> Bool) -> [a] -> [a}
so that removeFirst p xs removes the first element of xs that does has the property p.
2)Define a Haskell function
removeLast :: (a -> Bool) -> [a] -> [a]
so that removeLast p xs removes the last occurrence of element of xs that has the property p.
How could you define it using removeFirst?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
