simplify implementation of R.reverse