What is the generator syntax where the value of variables from one range can be used as limits for another range?
collect([a,b] for a=1:2, b=a:a+1)
ERROR: UndefVarError: a not defined
Expecting
[1, 1] [1, 2]
[2, 2] [2, 3]
Here’s an example where b
does not depend on a
.
collect([a,b] for a=1:2, b=4:5)
2×2 Array{Array{Int64,1},2}:
[1, 4] [1, 5]
[2, 4] [2, 5]