于 2010年06月18日 13:50, Richard Hainsworth 写道:
'flip' has more uses than just for strings. For example, it flips the
key/value in a pair. Hence,
my %h = Z 1,2,3,4; # a neat way of specifying a hash in
terms of two lists
say (map { .flip }, %h).perl; # the .perl gives you more information
about
于 2010年06月18日 13:32, Xi Yang 写道:
> Thanks!So the API has changed permanently?
I think so. The "reverse" is for arrays, and "flip" is for Strings.
于 2010年06月18日 13:25, Xi Yang 写道:
> I'm using rakudo 2010_05, with parrot 2.4.0. I found the $str.reverse just
> don't work at all:
> $ perl6 -e 'my $str="abcde"; say $str; say $str.reverse;'abcdeabcde
Use say $str.flip;