Skip to content
Prev 52348 / 63421 Next

R (development) changes in arith, logic, relop with (0-extent) arrays

Martin et al.,

I seem to be in the minority here, so I won't belabor the point too much,
but one last response inline:

On Thu, Sep 8, 2016 at 11:51 PM, Martin Maechler <maechler at stat.math.ethz.ch
In my view, the recycling rules apply first and foremost to pairs of
vectors of lengths n,m >=1. And they can be semantically explained in that
case very easily: "the shorter, non-zero-length vector is rep'ed out to be
the length of the longer vector and then (generally) an element wise
operation takes place". The zero-length behavior already does not adhere to
this definition, as it would be impossible to do in the case of a
zero-length vector and a nonzero-length vector.

So the zero-length recycling behavior is already special-cased as I
understand it. In light of that, it seems that it would be allowable to
have different behavior based on the length of the other vector.
Furthermore, while I acknowledge the usefulness of the

x = numeric()

x <  5


case (i.e., the other vector is length 1), I can't come up with any use of,
e.g.,

y  = numeric()
y < 3:5


That I can make any sense of other than as a violation of implicit
assumptions by the coder about the length of y.

Thus, I still think that should at *least* warn, preferably (imho) give an
error.

Best,
~G