replace f with a lambda