Adds functionality for set-nth.

Issue #578 
I'm seeing the following error when testing this

```
functions.cpp:1070:33: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated
      first [-Wparentheses]
        *result << (i == index) ? v : (*l)[i];
        ~~~~~~~~~~~~~~~~~~~~~~~ ^
```

This is easily fix by wrapping the expression in parens

```
*result << ((i == index) ? v : (*l)[i]);
```