Skip to content

Comment on Perl6: Unary Sortparent

Comments

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
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.