Apply a function to a vector or list iteratively, one element at a time.