Low functional programming of r