Method code for $dictionary.del_elem()

[Turn off line numbering]
  1: arg dict, key, elem;
  2: var value;
  3: 
  4: value = (| dict[key] |);
  5: if (type(value) != 'list && type(value) != 'error)
  6:     throw(~type, "Value for key " + key + " (" + value + ") is not a list.");
  7: anticipate_assignment();
  8: dict = dict_add(dict, key, 0);
  9: value = setremove(value, elem);
 10: if (!value)
 11:     return dict_del(dict, key);
 12: return dict_add(dict, key, value);

// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit

Tlon