Skip to content

Commit

Permalink
Merge pull request #3369 from Raku/method-perl-to-raku
Browse files Browse the repository at this point in the history
Change .perl to .raku in examples, ref #3309
  • Loading branch information
JJ committed May 7, 2020
2 parents e8240e3 + b9a5f40 commit a7dfb8a
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion doc/Type/Iterable.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Note that the flattening is recursive, so C<((("a", "b"), "c"),
"d").flat> returns C<("a", "b", "c", "d")>, but it does not flatten
itemized sublists:
say ($('a', 'b'), 'c').perl; # OUTPUT: «($("a", "b"), "c")␤»
say ($('a', 'b'), 'c').raku; # OUTPUT: «($("a", "b"), "c")␤»
You can use the L<hyper method call|/language/operators#index-entry-postfix_».> to
call the L«C<.List>|/routine/List» method on all the inner itemized sublists
Expand Down
6 changes: 3 additions & 3 deletions doc/Type/List.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,13 @@ Unlike C<map> it flattens non-itemized lists and arrays, so
## flatmap
my @list = ('first1', ('second2', ('third3', 'third4'), 'second5'), 'first6');
say @list.flatmap({.reverse}).perl;
say @list.flatmap({.reverse}).raku;
# OUTPUT «("first1", "second5", "third3", "third4", "second2", "first6").Seq␤»
## map
say @list.map({"$_ was a {.^name}"}).perl;
say @list.map({"$_ was a {.^name}"}).raku;
# OUTPUT «("first1 was a Str", "second2 third3 third4 second5 was a List", "first6 was a Str").Seq␤»
## .map .flat has the same output as .flatmap
say @list.map({.reverse}).flat.perl
say @list.map({.reverse}).flat.raku;
# OUTPUT «("first1", "second5", "third3", "third4", "second2", "first6").Seq␤»
=head2 method gist
Expand Down
2 changes: 1 addition & 1 deletion doc/Type/Metamodel/ClassHOW.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ NULL value) that can be tested for with a test for
L<definedness|/routine/defined>. It is potentially faster than C<.^can> but does
not provide a full list of all candidates.
say Str.^lookup('Int').perl; # OUTPUT: «method Int (Str:D $: *%_) { #`(Method|39910024) ... }␤»
say Str.^lookup('Int').raku; # OUTPUT: «method Int (Str:D $: *%_) { #`(Method|39910024) ... }␤»
for <upper-case uc> {
Str.^lookup: $^meth andthen .("foo").say
Expand Down
4 changes: 2 additions & 2 deletions doc/Type/Metamodel/MethodContainer.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ C<lookup> is supposed to be used for introspection, if you're after something
which can be invoked you probably want to use L<find_method|/routine/find_method>
instead.
say 2.5.^lookup("sqrt").perl: # OUTPUT: «method sqrt (Rat $: *%_) ...␤»
say Str.^lookup("BUILD").perl; # OUTPUT: «submethod BUILD (Str $: :$value = "", *%_ --> Nil) ...␤»
say 2.5.^lookup("sqrt").raku; # OUTPUT: «method sqrt (Rat $: *%_) ...␤»
say Str.^lookup("BUILD").raku; # OUTPUT: «submethod BUILD (Str $: :$value = "", *%_ --> Nil) ...␤»
say Int.^lookup("does-not-exist"); # OUTPUT: «(Mu)␤»
The difference between C<find_method> and C<lookup> are that C<find_method> will
Expand Down
4 changes: 2 additions & 2 deletions doc/Type/Metamodel/MultipleInheritance.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ a nested list is returned.
class B is C1 is C2 { };
class A is B { };
say A.^parents(:all).perl;
say A.^parents(:all).raku;
# OUTPUT: «(B, C1, C2, D, Any, Mu)␤»
say A.^parents(:all, :tree).perl;
say A.^parents(:all, :tree).raku;
# OUTPUT: «[B, ([C1, [D, [Any, [Mu]]]], [C2, [D, [Any, [Mu]]]])]␤»
=head2 method hides
Expand Down
2 changes: 1 addition & 1 deletion doc/Type/Method.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ injected into the scope specified by the declarator.
}
"greeting".$m("hello"); # OUTPUT: «greeting: 'hello'␤»
<a b c>.&(my method (List:D:) { say self.perl; self }).say;
<a b c>.&(my method (List:D:) { say self.raku; self }).say;
# OUTPUT: «("a", "b", "c")␤(a b c)␤»
The invocant of a method defaults to C<self>. A type constraint including a
Expand Down
2 changes: 1 addition & 1 deletion doc/Type/Routine.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ sub walk(\thing, *@keys) is rw {
my %hash;
walk(%hash, 'some', 'key', 1, 2) = 'autovivified';
say %hash.perl;
say %hash.raku;
=end code
produces
Expand Down

0 comments on commit a7dfb8a

Please sign in to comment.