How to updating within sapply (to avoid for loop)

Thanks for the response.

I believe if I give my actual problem here, that will be against the standing homework policy of this community. So, let me skip that primarily for that reason. Secondary reason follows.

If this is what a vectorized code is, then I'm pretty sure that it'll not be possible to vectorize my code. My problem specifically depend on the order of the arguments and the process itself is modified accordingly.

Still, out of curiosity, can you please show me how to vectorize my toy example? It's always good to learn something new :slightly_smiling_face: