Hacker News new | ask | show | jobs
by raiph 4566 days ago
I realize this is drifting off topic, and I could well believe the current Rakudo implementation doesn't actually save the memory (I could believe it does, I just don't know) but P6, for any method, including sort:

    my $a = [2,1]; say $a.sort;  say $a # 1 2 2 1
    my $a = [2,1]; say $a.=sort; say $a # 1 2 1 2
This riffs off the general op= syntax:

    my $a = 1; say $a +  1; say $a # 2 1
    my $a = 1; say $a += 1; say $a # 2 2