Skip to content

Instantly share code, notes, and snippets.

@nunorc
Created September 7, 2010 09:00
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 nunorc/568057 to your computer and use it in GitHub Desktop.
Save nunorc/568057 to your computer and use it in GitHub Desktop.
use List::Utils;
sub beadsort(@l) {
(transpose(transpose(map {[1 xx $_]}, @l))).map(*.elems);
}
my @list = 2,1,3,5;
say beadsort(@list).perl; # (5, 3, 2, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment