Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
reverse associativity on R ops
This seems slightly less unintuitive than the old semantics.
  • Loading branch information
TimToady committed Mar 30, 2015
1 parent d4e09ac commit 40163b8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions S03-operators.pod
Expand Up @@ -8,8 +8,8 @@ Synopsis 3: Operators

Created: 8 Mar 2004

Last Modified: 17 Jan 2015
Version: 284
Last Modified: 29 Mar 2015
Version: 285

=head1 Overview

Expand Down Expand Up @@ -4185,13 +4185,14 @@ by prefixing with C<R>. For instance, to do reversed comparisons:
R<=>

The precedence of any reversed operator is the same as the base operator.
The associativity is I<not> reversed, so
The associativity, however, is reversed, so

[R-] 1,2,3 # produces 2 from 3 - (2 - 1)
[R-] 1,2,3 # produces 0 from 3 - 2 - 1
[R**] 2,3,4 # produces 262144 from 4 ** 3 ** 2

To get the other effect in a reduce, reverse the list:

[-] reverse 1,2,3 # produces 0
Using both left and right associativity at the same precedence level is
not prohibited, but is likely to drive you mad, unless of course you were
mad in the first place, which seems almost a certainty by this point.

=head2 Hyper operators

Expand Down

0 comments on commit 40163b8

Please sign in to comment.