I have a question regarding Haskell who pounded my brain. I currently need to write a function that removes the line ie "word" from the list of strings ["hi", "today", "word", "Word", "WORD"] returns the list ["hi", "today", "Word", "WORD"] . I cannot use any functions of a higher order and I can use only primitive recursion.
Thinking about the problem, I thought that maybe I can solve it using recursion, in which you look at the start line of the first line if it matches "w" , then compare the next head with the tail and see if it matches "o" . But then I realized that after all this work, you wonβt be able to delete the full line of "word" .
My question is, how do I compare an entire line in a list, and not just compare one item at a time with something like: removeWord (x:xs) . Is it possible? Should I write a helper function to help with the solution?
source share