rrapply function

Reimplementation of base-R's rapply