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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!