Skip to content

Syntax Proposals / Multiple for loops

Is your feature request related to a problem? Please describe. Sometimes we want to iterate on multiple things at once. Particularly in the case of matrices (see #9).

Describe the solution you'd like Iterating on multiple things at once. We could authorize to chain for loops:

#CONSTRAINTS
   a >= x[i][j] for i in [0:2] for j in [0:3];

The evaluation order of the for loop is important. Left-to-right, as in python, is probably a good idea:

a >= i*10+j for i in [0:9] where i % 2 == 0 for j in [0:i] where j % 2 == 1

would be evaluated to

a >= 21
a >= 41
a >= 43
a >= 61
a >= 63
a >= 65
a >= 81
a >= 83
a >= 85
a >= 87
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information