>> Oh yes, that's a good point. But wouldn't the following do the job? >> >> "&.selector" <- function(a, b) { >> function(n) a(n) & b(n) >> } >> >> or >> >> "&.selector" <- function(a, b) { >> function(n) intersect(a(n), b(n)) >> } >> >> depending on whether selectors return logical or numeric vectors. >> Writing functions for | and ! would be similarly easy. Or am I >> missing something? > > No, I think those definitions would be fine, but I'd be concerned about > speed issues if we start messing with primitives.
Speed or expressiveness: pick one? ;) People could always use the regular subsetting mechanisms if they want the best speed - any changes to support selectors wouldn't affect the speed of the other methods of subsetting, would they? > While we're at it, we might as well do the same sort of thing for :, and > define a selector named end, and then 3:end would give a selector from 3 to > the end, which brings us back to the original question. So it's not nearly > as intrusive as I thought it would be. 3:end() do you mean? Or do you mean extending seq so that it uses unevaluted input? Hadley -- http://had.co.nz/ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.