Remove elements at positions n and n-1 in a Haskell list, when n fits a predicate
问题 Say I have a list of all the integers from 2 to 20 . [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] I also have a function f x that returns either True or False . When I apply this function to the element at position n and it equals to True , I want to remove it and its precedent element (which is the element at position n-1 ). I want to keep doing this until the list is empty of elements for which the function equals to True , as well as their preceding elements. Example: Let's say that