Here are three (I, II, III) implementations.
import Random.seed! as seed!
import Random.shuffle as shuffle
seed!(1); # [Code I]
for i = shuffle(1:3)
for j = shuffle(1:4)
println("($i, $j)")
end
end
seed!(1); # [Code II]
for i = shuffle(1:3), j = shuffle(1:4)
println("($i, $j)") # its inner layer sequence varies!
end
seed!(1); # [Code III]
let I = shuffle(1:3), J = shuffle(1:4)
@show I J;
for i = I, j = J
println("($i, $j)") # its inner layer sequence are the same.
end
end;
In my intuition (and I believe it should be so), Code II
should resolves into Code III
. (cf. my intuition here).
But the current behavior implies as if Code II
instead resolves into Code I
, which I think is not understandable.
The style in Code I
and Code II
are very different—e.g., only one break
is entailed to escape the for
in Code II
, whereas you need two in Code I
.