src/Pure/General/graph.ML
changeset 31971 8c1b845ed105
parent 31616 63893e3a50a6
child 32709 c5956b54a460
equal deleted inserted replaced
31970:ccaadfcf6941 31971:8c1b845ed105
    50   val add_edge_trans_acyclic: key * key -> 'a T -> 'a T               (*exception CYCLES*)
    50   val add_edge_trans_acyclic: key * key -> 'a T -> 'a T               (*exception CYCLES*)
    51   val merge_trans_acyclic: ('a * 'a -> bool) -> 'a T * 'a T -> 'a T   (*exception CYCLES*)
    51   val merge_trans_acyclic: ('a * 'a -> bool) -> 'a T * 'a T -> 'a T   (*exception CYCLES*)
    52   val extend: (key -> 'a * key list) -> key -> 'a T -> 'a T
    52   val extend: (key -> 'a * key list) -> key -> 'a T -> 'a T
    53 end;
    53 end;
    54 
    54 
    55 functor GraphFun(Key: KEY): GRAPH =
    55 functor Graph(Key: KEY): GRAPH =
    56 struct
    56 struct
    57 
    57 
    58 (* keys *)
    58 (* keys *)
    59 
    59 
    60 type key = Key.key;
    60 type key = Key.key;
    65 val remove_key = remove eq_key;
    65 val remove_key = remove eq_key;
    66 
    66 
    67 
    67 
    68 (* tables and sets of keys *)
    68 (* tables and sets of keys *)
    69 
    69 
    70 structure Table = TableFun(Key);
    70 structure Table = Table(Key);
    71 type keys = unit Table.table;
    71 type keys = unit Table.table;
    72 
    72 
    73 val empty_keys = Table.empty: keys;
    73 val empty_keys = Table.empty: keys;
    74 
    74 
    75 fun member_keys tab = Table.defined (tab: keys);
    75 fun member_keys tab = Table.defined (tab: keys);
   297 (*final declarations of this structure!*)
   297 (*final declarations of this structure!*)
   298 val fold = fold_graph;
   298 val fold = fold_graph;
   299 
   299 
   300 end;
   300 end;
   301 
   301 
   302 structure Graph = GraphFun(type key = string val ord = fast_string_ord);
   302 structure Graph = Graph(type key = string val ord = fast_string_ord);
   303 structure IntGraph = GraphFun(type key = int val ord = int_ord);
   303 structure IntGraph = Graph(type key = int val ord = int_ord);