Re: [Rd] capture "->"

2024-03-01 Thread avi.e.gross
Adrian, That is indeed a specialized need albeit not necessarily one that cannot be done by requiring an alternate way of typing a formula that avoids being something the parser sees as needed to do at that level. In this case, my other questions become moot as I assume the global assignment

Re: [Rd] capture "->"

2024-03-01 Thread Adrian Dușa
I would also be interested in that. For me, this is interesting for my QCA package, over which Dmitri and I have exchanged a couple of messages. The "<-" operator is used to denote necessity, and the "->" is used for sufficiency. Users often make use of Boolean expressions such as A*B + C -> Y (to

Re: [Rd] capture "->"

2024-03-01 Thread avi.e.gross
I am wondering what the specific need for this is or is it just an exercise? Where does it matter if a chunk of code assigns using "<-" beforehand or "->" after hand, or for that matter assigns indirectly without a symbol? And whatever you come up with, will it also support the global assignment

Re: [Rd] capture "->"

2024-03-01 Thread Duncan Murdoch
On 01/03/2024 8:51 a.m., Dmitri Popavenko wrote: On Fri, Mar 1, 2024 at 1:00 PM Duncan Murdoch > wrote: ... I was thinking more of you doing something like   parse(text = "A -> B", keep.source = TRUE) I forget what the exact rules are for attac

Re: [Rd] capture "->"

2024-03-01 Thread Dmitri Popavenko
On Fri, Mar 1, 2024 at 1:00 PM Duncan Murdoch wrote: > ... > I was thinking more of you doing something like > > parse(text = "A -> B", keep.source = TRUE) > > I forget what the exact rules are for attaching srcrefs to arguments of > functions, but I do remember they are a little strange, becau

Re: [Rd] capture "->"

2024-03-01 Thread Duncan Murdoch
On 01/03/2024 5:25 a.m., Dmitri Popavenko wrote: Dear Duncan, On Fri, Mar 1, 2024 at 11:30 AM Duncan Murdoch > wrote: ... If you parse it with srcrefs, you could look at the source.  The parser doesn't record whether it was A -> B or B <- A anywhere

Re: [Rd] capture "->"

2024-03-01 Thread Dmitri Popavenko
Dear Duncan, On Fri, Mar 1, 2024 at 11:30 AM Duncan Murdoch wrote: > ... > If you parse it with srcrefs, you could look at the source. The parser > doesn't record whether it was A -> B or B <- A anywhere else. > Thank you, this gets me closer but it still needs a little push: > foo <- functio

Re: [Rd] capture "->"

2024-03-01 Thread Duncan Murdoch
On 01/03/2024 4:17 a.m., Dmitri Popavenko wrote: Hi everyone, I am aware this is a parser issue, but is there any possibility to capture the use of the inverse assignment operator into a formula? Something like: foo <- function(x) substitute(x) gives: foo(A -> B) B <- A I wonder if ther

[Rd] capture "->"

2024-03-01 Thread Dmitri Popavenko
Hi everyone, I am aware this is a parser issue, but is there any possibility to capture the use of the inverse assignment operator into a formula? Something like: > foo <- function(x) substitute(x) gives: > foo(A -> B) B <- A I wonder if there is any possibility whatsoever to signal the use o