Re: [Rd] Ordered comparison operators on language objects will signal errors

2024-03-04 Thread Henrik Bengtsson
On Mon, Mar 4, 2024 at 8:45 AM luke-tierney--- via R-devel wrote: > > Comparison operators == and != can be used on language objects > (i.e. call objects and symbols). The == operator in particular often > seems to be used as a shorthand for calling identical(). The current > implementation involv

Re: [Rd] [External] Re: capture "->"

2024-03-04 Thread Duncan Murdoch
That's a good suggestion, but if the function accepts strings, the problem is fairly easy using the parser. E.g. compare > getParseData( parse(text="x1 + x2 -> a3") ) line1 col1 line2 col2 id parenttoken terminal text 11 11 1 13 11 0 exprFALSE 7 1

Re: [Rd] [External] Re: capture "->"

2024-03-04 Thread Bill Dunlap
Maybe someone has already suggested this, but if your functions accepted strings you could use sub or gsub to replace the -> with a symbol that parsed at the same precedence as <-, say <<-. Then parse it and deal with it. When it is time to display the parsed and perhaps manipulated formulae to t

[Rd] Ordered comparison operators on language objects will signal errors

2024-03-04 Thread luke-tierney--- via R-devel
Comparison operators == and != can be used on language objects (i.e. call objects and symbols). The == operator in particular often seems to be used as a shorthand for calling identical(). The current implementation involves comparing deparsed calls as strings. This has a number of drawbacks and w

Re: [Rd] [External] Re: capture "->"

2024-03-04 Thread Dmitri Popavenko
Dear Barry, In general, I believe users are already accustomed with the classical arrows "->" and "<-" which are used as such in quoted expressions. But I agree that "-.>" is a very neat trick, thanks a lot. A small dot, what a difference. All the best, Dmitri On Mon, Mar 4, 2024 at 11:40 AM Bar

Re: [Rd] [External] Re: capture "->"

2024-03-04 Thread Barry Rowlingson
It seems like you want to use -> and <- as arrows with different meanings to "A gets the value of B" in your package, as a means of writing expressions in your package language. Another possibility would be to use different symbols instead of the problematic -> and <-, for example you could use <.