Re: [Rd] Recycling in arithmetic operations involving zero-length vectors

2023-01-16 Thread GILLIBERT, Andre
Duncan Murdoch wrote: > To even do that, we would have to first decide which "cases" should produce a > warning. > Let's say `1 + x` should give a warning when x = numeric(0). Then should > `x^2` also produce a warning? Should `x^0.5`? Should `sqrt(x)`? > Should `log(x)`? The most probable

Re: [Rd] Recycling in arithmetic operations involving zero-length vectors

2023-01-16 Thread Deepayan Sarkar
On Mon, Jan 16, 2023 at 7:28 PM Duncan Murdoch wrote: > > On 16/01/2023 6:55 a.m., David Winsemius wrote: > > > > > > Sent from my iPhone > > > >> On Jan 16, 2023, at 6:11 PM, Duncan Murdoch > >> wrote: > >> > >> On 16/01/2023 5:23 a.m., Roland Fuß wrote: > >>> Dear R-core, > >>> The language

[Rd] memory leak in png()

2023-01-16 Thread Edward Ionides
Hi all, Yesterday I discovered what seems to me like a memory leak in png() so I'm reporting it in case that is helpful. Here is a small reproducible example: R -d "valgrind --tool=memcheck --track-origins=yes --leak-check=full" --vanilla -e "png(filename='p.png'); plot(1:10); dev.off()" ## HAS

Re: [Rd] Recycling in arithmetic operations involving zero-length vectors

2023-01-16 Thread Duncan Murdoch
On 16/01/2023 6:55 a.m., David Winsemius wrote: Sent from my iPhone On Jan 16, 2023, at 6:11 PM, Duncan Murdoch wrote: On 16/01/2023 5:23 a.m., Roland Fuß wrote: Dear R-core, The language definition is very clear: "As from R 1.4.0, any arithmetic operation involving a zero-length vector

Re: [Rd] Recycling in arithmetic operations involving zero-length vectors

2023-01-16 Thread David Winsemius
Sent from my iPhone > On Jan 16, 2023, at 6:11 PM, Duncan Murdoch wrote: > > On 16/01/2023 5:23 a.m., Roland Fuß wrote: >> Dear R-core, >> The language definition is very clear: >> "As from R 1.4.0, any arithmetic operation involving a zero-length >> vector has a zero-length result." >>

Re: [Rd] Recycling in arithmetic operations involving zero-length vectors

2023-01-16 Thread Duncan Murdoch
On 16/01/2023 5:23 a.m., Roland Fuß wrote: Dear R-core, The language definition is very clear: "As from R 1.4.0, any arithmetic operation involving a zero-length vector has a zero-length result." Thus, `1 + numeric()` returns `numeric(0)`. However, I don't find this very intuitive because

[Rd] Recycling in arithmetic operations involving zero-length vectors

2023-01-16 Thread Roland Fuß
Dear R-core, The language definition is very clear: "As from R 1.4.0, any arithmetic operation involving a zero-length vector has a zero-length result." Thus, `1 + numeric()` returns `numeric(0)`. However, I don't find this very intuitive because usually the shorter vector is recycled to