I could turn the sum/min/max/avg as both blocks and scoped blocks. But the syntax might become a little confusing, perhaps i could add a special syntax to clearly distinguish between scoped and unscoped blocks?
currently scoped blocks are the kind where
sum(i in 0..5) { exp }
will be converted into a sum of the expressions inside of it, and this will also add the values of the scope to the block in the exp.
at the same time there is:
min { x_1, x_2, x_3 }
which currently has no way to specify the scope, so it must be manually written out. an example of this could be trying to calculate the average of a row in a matrix
min 1
s.t.
sum(row in M) { avg { ??? } } <= 3
where
M = [
[1,2,3],
[4,5,6]
]
i could turn this into:
sum(row in M) { avg(el in row){ el } } <= 3
but then would this look ugly syntax wise?
the min/max/avg blocks make sense to be both scoped and unscoped, but for example the sum block doesn't make sense to be
I could turn the sum/min/max/avg as both blocks and scoped blocks. But the syntax might become a little confusing, perhaps i could add a special syntax to clearly distinguish between scoped and unscoped blocks? currently scoped blocks are the kind where
will be converted into a sum of the expressions inside of it, and this will also add the values of the scope to the block in the exp. at the same time there is:
which currently has no way to specify the scope, so it must be manually written out. an example of this could be trying to calculate the average of a row in a matrix
i could turn this into:
but then would this look ugly syntax wise? the min/max/avg blocks make sense to be both scoped and unscoped, but for example the sum block doesn't make sense to be