Function to apply a function to a subfield of a field