diff --git a/doc/Language/operators.pod6 b/doc/Language/operators.pod6 index a3cf4a1ce..da37dd13d 100644 --- a/doc/Language/operators.pod6 +++ b/doc/Language/operators.pod6 @@ -281,15 +281,29 @@ X<|»=«> X<|«=»> =head1 X<<>;hyper,«;hyper,»;>>> -Hyper operators include C<«> and C<»>, with their ASCII variants C«<<» -and C«>>». They apply a given operator enclosed (or preceded or followed, in the case of unary operators) by C<«> and/or C<»> to one or two -lists, returning the resulting list, with the pointy part of C<«> or C<»> aimed at the shorter list. Single elements are turned to a list, so they can be used too. If one of -the lists is shorter than the other, the operator will cycle over the shorter -list until all elements of the longer list are processed. +Hyper operators include C<«> and C<»>, with their ASCII variants C«<<» and +C«>>». They apply a given operator enclosed (or preceded or followed, in the +case of unary operators) by C<«> and/or C<»> to one or two lists, returning the +resulting list, with the pointy part of C<«> or C<»> aimed at the shorter list. +Single elements are turned to a list, so they can be used too. If one of the +lists is shorter than the other, the operator will cycle over the shorter list +until all elements of the longer list are processed. say (1, 2, 3) »*» 2; # OUTPUT: «(2 4 6)␤» say (1, 2, 3, 4) »~» ; # OUTPUT: «(1a 2b 3a 4b)␤» say (1, 2, 3) »+« (4, 5, 6); # OUTPUT: «(5 7 9)␤» + say (&sin, &cos, &sqrt)».(0.5); + # OUTPUT: «(0.479425538604203 0.877582561890373 0.707106781186548)␤» + +The last example illustrates how postcircumfix operators (in this case .()) can +also be hypered. + + my @a = <1 2 3>; + my @b = <4 5 6>; + say (@a,@b)»[1]; # OUTPUT: «(2 5)␤» + +In this case, it's the [postcircumfix +[]](/language/operators#index-entry-.%5B_%5D) which is being hypered. Assignment metaoperators can be I. @@ -313,8 +327,8 @@ Hyper operators are defined recursively on nested arrays. say -« [[1, 2], 3]; # OUTPUT: «[[-1 -2] -3]␤» Also, methods can be called in an out of order, concurrent fashion. The -resulting list is in order. Note that all hyper operators are candidates for -autothreading and will cause tears if the methods have side effects. The +resulting list will be in order. Note that all hyper operators are candidates +for autothreading and will cause tears if the methods have side effects. The optimizer has full reign over hyper operators, which is the reason that they cannot be defined by the user. @@ -385,8 +399,8 @@ X<|[] (reduction metaoperators)>X<|[+] (reduction metaoperators)> =head1 Reduction metaoperators The reduction metaoperator, C<[ ]>, reduces a list with the given infix -operator. It gives the same result as the L routine - see there for -details. +operator. It gives the same result as the L routine - +see there for details. # These two are equivalent: say [+] 1, 2, 3; # OUTPUT: «6␤»