Builds a new array by applying a function to all elements