Method code for $list.set_equal()

[Turn off line numbering]
  1: arg set1, set2;
  2: var e, dict1, dict2;
  3: 
  4: // True if the two lists given contain the same elements.
  5: // False otherwise.
  6: dict1 = hash e in (set1) to ([e, 1]);
  7: dict2 = hash e in (set2) to ([e, 1]);
  8: for e in (dict1.keys()) {
  9:     if (!dict_contains(dict2, e))
 10:         return 0;
 11: }
 12: for e in (dict2.keys()) {
 13:     if (!dict_contains(dict1, e))
 14:         return 0;
 15: }
 16: return 1;

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

Tlon