TEXT   43

ord-set

Guest on 15th May 2022 04:29:01 AM

  1. item = Key.ord_key
  2.  
  3. type set
  4.  
  5. val empty : set
  6.  
  7. val singleton : item -> set
  8.  
  9.     Create a singleton set
  10.  
  11.  
  12. val add : set * item -> set
  13.  
  14. val add' : (item * set) -> set
  15.  
  16.     Insert an item.
  17.  
  18.  
  19. val addList : set * item list -> set
  20.  
  21.     Insert items from list.
  22.  
  23.  
  24. val delete : set * item -> set
  25.  
  26.     Remove an item. Raise NotFound if not found.
  27.  
  28.  
  29. val member : set * item -> bool
  30.  
  31.     Return true if and only if item is an element in the set
  32.  
  33.  
  34. val isEmpty : set -> bool
  35.  
  36.     Return true if and only if the set is empty
  37.  
  38.  
  39. val equal : (set * set) -> bool
  40.  
  41.     Return true if and only if the two sets are equal
  42.  
  43.  
  44. val compare : (set * set) -> order
  45.  
  46.     does a lexical comparison of two sets
  47.  
  48.  
  49. val isSubset : (set * set) -> bool
  50.  
  51.     Return true if and only if the first set is a subset of the second
  52.  
  53.  
  54. val numItems : set -> int
  55.  
  56.     Return the number of items in the table
  57.  
  58.  
  59. val listItems : set -> item list
  60.  
  61.     Return an ordered list of the items in the set

Raw Paste


Login or Register to edit or fork this paste. It's free.