Message-ID: <27F87D52-3668-486C-A843-37CC597FA984@gmail.com>
Date: 2023-04-22T01:23:44Z
From: Dominick Samperi
Subject: Generalised piping into operators
In-Reply-To: <df77cd83-2500-49df-2406-d6e218a832c6@gmail.com>
A few years ago there was a post by the author of pipeR suggesting improvements in efficiency and reliability. Is there collaboration between these various pipe projects?
Sent from my iPhone
> On Apr 21, 2023, at 1:01 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>
> ?On 21/04/2023 12:16 p.m., Michael Milton wrote:
>> I'm afraid I don't understand. I know that parsing `+`(1, 1) returns a result equivalent to `1 + 1`, but why does that impose a restriction on parsing the pipe operator? What is the downside of allowing arbitrary RHS functions?
>
> I thought the decision to exclude "_ + 1" happens after enough parsing has happened so that the code making the decision can't tell the difference between "_ + 1" and "`+`(_, 1)". I might be wrong about that, but this suggests it:
>
> > quote(_ + 1)
> Error in quote("_" + 1) : invalid use of pipe placeholder (<input>:1:0)
> > quote(`+`(_, 1))
> Error in quote("_" + 1) : invalid use of pipe placeholder (<input>:1:0)
>
> On the other hand, this works:
>
> > quote(x |> `+`(e1 = _, 1))
> x + 1
>
> So maybe `+`() is fine after all.
>
> Duncan Murdoch
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel