public
Created

Cool use for a macro: meta for

  • Download Gist
metafor.md
Markdown

Instead of...

for 1..10 -> $i {
    for 1..^$i -> $j {
        for 1..^$j -> $k {
            ...
        }
    }
}

How about this?

meta for 1..10 -> $i, 1..^$i -> $j, 1..^$j -> $k {
    ...
}

Or, if the number of for levels might vary,

constant $LEVELS = ...;
meta for 1..10, { 1..$^previous } xx $LEVELS {
    ...
}

I have no idea if the above can be made to work, but I'm eager to find out.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.