Set the nth element in a list

Addresses #852.