let filter env f = 
  List.fold_left (fun acu (_, x) -> if f x then x :: acu else acu) [] env