Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Cool use for a macro: meta for

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.