(S)DT 2012-2013 66 filter :: (t -> Bool) -> [t] -> [t] filter p [] = [] filter p (x:xs) | p x = x : rest | otherwise = rest where rest = filter p xs Miranda Lisp, ML, Scheme filter = \p -> \xs -> case xs of [] -> [] (x:xs) -> let rest = filter p xs in if (p x) then x : rest else rest
{}