Removes an item from a collection, and returns it.
The simplest way to call this function is (remove! coll key)
. If the index key
is not
present, it's an error.
The ?
special syntax can be used to permit missing items: (remove! coll (? key))
.
In that case, if the index key
is not present, the function will succeed and return #n
.
When coll
is a deque, slicing syntax is supported: (remove! coll 2 :)
.
This will remove all elements with an index of 2 or more, returning them as
a freshly-allocated, mutable deque.