The following functions each take predicate function and a list as input, and remove certain items from the list based on the predicate function. They each have this signature:
(a -> Bool) -> [a] -> [a]
a. ltrim removes all items from the start of the list that satisfy the predicate function.
b. rtrim removes all items from the end of the list that satisfy the predicate function.
c. trim removes all items from both the start and end of the list that satisfy the predicate function.
What's the solution?
- Jun. 07, 2023