You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Julia, element-wise operations can be realized by the dot symbol ".". However, for arithmetic operations like "+", "-", "*", "/", etc., the dot is put before the operation symbol, e.g. ".+", ".-", while for functions the dot is put after the function name. Since these operation symbols are also generic functions in Julia (we can write +(1, 2) as an equivalent of 1+2), would it be more consistent if the dot is put after the function for both symbolic operations and named functions? For example, 1+.x instead of 1 .+ x.
The text was updated successfully, but these errors were encountered:
That inconsistency seems to only affect operators for which there is an in-fix notation available. When using pre-fix notation, the same rule applies as for every other function:
julia> x = (1,2)
(1, 2)
julia> (+).(1, x)
(2, 3)
Since in-fix notation is special ("inconsistent") compared to the usual function notation, I'd argue that the inconsistency about the broadcasting dot is consistent. 😄
In Julia, element-wise operations can be realized by the dot symbol ".". However, for arithmetic operations like "+", "-", "*", "/", etc., the dot is put before the operation symbol, e.g. ".+", ".-", while for functions the dot is put after the function name. Since these operation symbols are also generic functions in Julia (we can write
+(1, 2)
as an equivalent of1+2
), would it be more consistent if the dot is put after the function for both symbolic operations and named functions? For example,1+.x
instead of1 .+ x
.The text was updated successfully, but these errors were encountered: