Re: [Rd] order of operations

2021-08-28 Thread Duncan Murdoch
On 28/08/2021 3:44 a.m., GILLIBERT, Andre wrote: For the discussion: > Yes, and were it not for 0 * NA == NA, you might skip evaluation of y if x evaluates to zero. With the same idea, NA * (alpha <- 6) could skip the assignment. No, it can't, because until it evaluates the assignment it

Re: [Rd] order of operations

2021-08-28 Thread GILLIBERT, Andre
For the discussion: > Yes, and were it not for 0 * NA == NA, you might skip evaluation of y if x > evaluates to zero. With the same idea, NA * (alpha <- 6) could skip the assignment. I do not think that, on the short term, R would do that thing, but who knows in the future! As of R 4.1, typ

Re: [Rd] order of operations

2021-08-28 Thread peter dalgaard
Yes, and were it not for 0 * NA == NA, you might skip evaluation of y if x evaluates to zero. In Andre Gillibert's example: 1 | (alpha<-6) there really is no reason to evaluate the assignment since (1 | any) is always TRUE. Notwithstanding method dispatch, that is. With general function call