Adds 'array_average' helper function.