Next: dict_keys

Prev: dict_del

dict_del_elem

dict_del_elem(dictionary, key, element)
This function returns the result of removing element from the list value of key in dictionary. If dictionary contains no association with key key, then dict_del_elem() throws a ~keynf error. If dictionary contains an association with key key, and it is not a list, then dict_del_elem() throws a ~type error.

Assuming that dictionary contains an association with key key, and it is a list, dict_del_elem() removes the first occurrence of element in the list if element occurs in the list. If the resulting list is an empty list, then dict_del_elem() removes the association from dictionary altogether. If element does not occur in the list, then dict_del_elem() returns dictionary unchanged.

Examples:

dict_del_elem(#[["foo", ["bar", "baz"]]], "foo", "bar")
     => #[["foo", ["baz"]]]
dict_del_elem(#[["foo", ["baz"]]], "foo", "baz")
     => #[]