Rearrange a number into alphabetical order
Perl 6, &nbsp;32&nbsp; 28 bytes



{+[~] .comb.sort: *.Str.uniname}
{+[~] .comb.sort: *.uniname}


Explanation:

{
  # turn the following into a Numeric
  +

  # fold the following list using string concatenation operator
  [~]

    # split $_ into individual characters
    # (implicit method call on implicit parameter)
    .comb

    .sort:
    *.uniname # sort by the Unicode name of the character (digit)
}


Test:

#! /usr/bin/env perl6
use v6.c;
use Test;

my @tests = (
  101 =&gt; 110,
  31948 =&gt; 84913,
  5544 =&gt; 5544,
  1234567890 =&gt; 8549176320,
);

# give the lambda a lexical name for clarity
my &amp;int-sort = {+[~] .comb.sort: *.uniname}

plan 3 * @tests;

for @tests -&gt; $_ ( :key($input), :value($expected) ) {
  put '';
  isa-ok $input, Int, "input ($input) is an Int";

  my $output = int-sort $input;

  is $output, $expected, .gist;
  isa-ok $output, Int, "output ($output) is an Int"
}




1..12

ok 1 - input (101) is an Int
ok 2 - 101 =&gt; 110
ok 3 - output (110) is an Int

ok 4 - input (31948) is an Int
ok 5 - 31948 =&gt; 84913
ok 6 - output (84913) is an Int

ok 7 - input (5544) is an Int
ok 8 - 5544 =&gt; 5544
ok 9 - output (5544) is an Int

ok 10 - input (1234567890) is an Int
ok 11 - 1234567890 =&gt; 8549176320
ok 12 - output (8549176320) is an Int