The sum inside macros does not need the init for empty collections:
julia> @expression(m, sum(2 for i in 1:0))
0.0
julia> sum(2 for i in 1:0)
ERROR: ArgumentError: reducing over an empty collection is not allowed; consider supplying `init` to the reducer
However, AI insists in:
julia> @expression(m, sum(2 for i in 1:0), init = AffExp(0.0))
0.0
We should clarify in macros docs / getting started / performance / good practices.
The sum inside macros does not need the init for empty collections:
However, AI insists in:
We should clarify in macros docs / getting started / performance / good practices.