src/Pure/General/table.ML
changeset 50234 c97c5c34fb1d
parent 47980 c81801f881b3
child 52049 156e12d5cb92
equal deleted inserted replaced
50233:eef21a0726f1 50234:c97c5c34fb1d
    53   val remove_list: ('b * 'a -> bool) -> key * 'b -> 'a list table -> 'a list table
    53   val remove_list: ('b * 'a -> bool) -> key * 'b -> 'a list table -> 'a list table
    54   val update_list: ('a * 'a -> bool) -> key * 'a -> 'a list table -> 'a list table
    54   val update_list: ('a * 'a -> bool) -> key * 'a -> 'a list table -> 'a list table
    55   val make_list: (key * 'a) list -> 'a list table
    55   val make_list: (key * 'a) list -> 'a list table
    56   val dest_list: 'a list table -> (key * 'a) list
    56   val dest_list: 'a list table -> (key * 'a) list
    57   val merge_list: ('a * 'a -> bool) -> 'a list table * 'a list table -> 'a list table
    57   val merge_list: ('a * 'a -> bool) -> 'a list table * 'a list table -> 'a list table
       
    58   type set = unit table
       
    59   val make_set: key list -> set                                        (*exception DUP*)
    58 end;
    60 end;
    59 
    61 
    60 functor Table(Key: KEY): TABLE =
    62 functor Table(Key: KEY): TABLE =
    61 struct
    63 struct
    62 
    64 
   392 fun make_list args = fold_rev cons_list args empty;
   394 fun make_list args = fold_rev cons_list args empty;
   393 fun dest_list tab = maps (fn (key, xs) => map (pair key) xs) (dest tab);
   395 fun dest_list tab = maps (fn (key, xs) => map (pair key) xs) (dest tab);
   394 fun merge_list eq = join (fn _ => Library.merge eq);
   396 fun merge_list eq = join (fn _ => Library.merge eq);
   395 
   397 
   396 
   398 
       
   399 (* unit tables *)
       
   400 
       
   401 type set = unit table;
       
   402 
       
   403 fun make_set entries = fold (fn x => update_new (x, ())) entries empty;
       
   404 
       
   405 
   397 (* ML pretty-printing *)
   406 (* ML pretty-printing *)
   398 
   407 
   399 val _ =
   408 val _ =
   400   PolyML.addPrettyPrinter (fn depth => fn pretty => fn tab =>
   409   PolyML.addPrettyPrinter (fn depth => fn pretty => fn tab =>
   401     ml_pretty
   410     ml_pretty