Skip to content
Prev 59422 / 63430 Next

[External] brief update on the pipe operator in R-devel

On 12/01/2021 3:52 p.m., Bill Dunlap wrote:
The precedence of it as an operator is determined by what makes sense in 
the pipe construction.  Currently precedence appears to be


:: :::	access variables in a namespace
$ @	component / slot extraction
[ [[	indexing
^	exponentiation (right to left)
- +	unary minus and plus
:	sequence operator
%any%	special operators (including %% and %/%)
* /	multiply, divide
+ -	(binary) add, subtract
< > <= >= == !=	ordering and comparison
!	negation
& &&	and
| ||	or
=>      PIPE BIND
|>      PIPE
~	as in formulae
-> ->>	rightwards assignment
<- <<-	assignment (right to left)
=	assignment (right to left)
?	help (unary and binary)

(Most of this is taken from ?Syntax, but I added the new operators in 
based on the gram.y file).  So

A & B => C & D

would appear to be parsed as

(A & B) => (C & D)

I think this also makes sense; do you?

Duncan Murdoch