Next: listlen

Prev: delete

insert

insert(list, position, data)
This function returns the result of inserting data into list before the element numbered by the integer position. If position is less than one or is more than one more than the length of list, then insert() throws a ~range error.

Examples:

insert([2, 3, 4], 3, 'foo)
     => [2, 3, 'foo, 4]
insert(["foo", 'bar, ~none], 4, 'baz)
     => ["foo", 'bar, ~none, 'baz]