code to take a scalar function and wrap it in an sapply so it is vectorized
vectorizing fns