filterIf

write a function that, given a List of integers and a predicate function p that takes an integer and returns a boolean, returns another list consisting of elements  x of the original list such that  p x = true.

Function Signature

def filterIf(xs:List Int)(p:Int->Bool):List Int

Theorem Signature


theorem filterIf_correct(xs:List Int)(p:Int->Bool):
  filterIf xs p = List.filter p xs

View All Submissions

Please log in or register to submit a solution for this challenge.