extract logic common to R.lPartial and R.rPartial

We should determine the performance cost before merging this change. I imagine it'll be fairly small.