-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
i skimmed the other map thread and felt that this was off topic enough and not as important, so i decided to start another thread (even though they talk about the same function)
if the function has 1 argument then its done simply like so
julia> map(char, [1,2,3,4])
['\x01','\x02','\x03','\x04']
however if the requires multiple arguments this has to be done with an array of arrays
julia> map(x->is(x[1],x[2]), {{2,3},{3,4},{4,5}})
{6,12,20}
this is inconsistency could be fixed, by forcing even the 1-dimensional case also require a array of arrays. This however, would seem to make the matters of calling this function worse. But would be entirely consistent
i feel the optimal solution, is that if the function being passed has a predefined number of arguments, that it automatically set picks out that number of arguments from array, and only if the function usess the ... must u pass it an array of arrays
exmaple:
julia> function threenumadd(num1,num2,num3)
num1+num2+num3
end
julia> map(threenumadd, [1,2,3,4,5,6])
[6,15]
julia> map(+, {{1,2},{3,4},{5,6}})
[3,7,11]