--- a/src/Pure/General/table.ML Sat Apr 29 23:16:47 2006 +0200
+++ b/src/Pure/General/table.ML Sat Apr 29 23:16:48 2006 +0200
@@ -51,6 +51,7 @@
val remove: ('b * 'a -> bool) -> key * 'b -> 'a table -> 'a table
val lookup_list: 'a list table -> key -> 'a list
val update_list: (key * 'a) -> 'a list table -> 'a list table
+ val insert_list: ('a * 'a -> bool) -> key * 'a -> 'a list table -> 'a list table
val remove_list: ('b * 'a -> bool) -> key * 'b -> 'a list table -> 'a list table
val make_list: (key * 'a) list -> 'a list table
val dest_list: 'a list table -> (key * 'a) list
@@ -374,6 +375,8 @@
fun lookup_list tab key = these (lookup tab key);
fun update_list (key, x) tab = modify key (fn NONE => [x] | SOME xs => x :: xs) tab;
+fun insert_list eq (key, x) = default (key, []) #> map_entry key (Library.insert eq x);
+
fun remove_list eq (key, x) tab =
map_entry key (fn xs => (case Library.remove eq x xs of [] => raise UNDEF key | ys => ys)) tab
handle UNDEF _ => delete key tab;