let rec select (f:'a -> bool) (l:'a list) = match l with | [] -> [] | x::c -> if (f x) then (x::(select f c)) else (select f c)