Skip to content

Instantly share code, notes, and snippets.

@Tux
Created September 16, 2015 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tux/bcaaa0d9902b0993bf92 to your computer and use it in GitHub Desktop.
Save Tux/bcaaa0d9902b0993bf92 to your computer and use it in GitHub Desktop.
method to_list () {
lazy gather {
my Int $max = -1;
for sort @!ranges -> $r {
my $from = ($r.key, $max + 1).max.Int;
my $to = $r.value;# == Inf ?? 65535 !! $r.value;
take (($from .. $to).Slip);
$r.value == Inf and last;
$max = ($max, $r.value).max.Int;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment