This program was supposed to write triples of indices for which the sum is less than or equal to 7:
for ((1..7) X (1..7)) X (1..7) { .say if [+] $_ <= 7; }
I thought it would only be a cycle above the top level of the list (and then the code will have an error in the body of the cycle, but thatโs not the point), but it just goes through individual numbers, which upsets :( Is there a neat trick to avoid this? And BTW, is there a way to make an n-ary direct product?
source share