Crate dedup_by
Removes consecutive repeated elements in the vector based on whether the provided funciton 'f' returns true (remove) or false (do not remove).