Adds functionality for set-nth.

Issue #578 
Ah thanks I figured there was a better way to do this part.