Skip to content

Instantly share code, notes, and snippets.

@sekia
Created January 5, 2012 08:01
Show Gist options
  • Save sekia/1564198 to your computer and use it in GitHub Desktop.
Save sekia/1564198 to your computer and use it in GitHub Desktop.
use v6;
sub mapBetween(@list, &fn) {
sub infix:<op>($a, $b) { &fn($a, $b) };
@list <<op<< @list[1..*];
}
say mapBetween([1..5], &[+]); # 3 5 7 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment