Ignore:
Timestamp:
Feb 27, 2013, 2:03:12 PM (8 years ago)
Author:
sacerdot
Message:

Porting the graph colouring stuff from the untrusted prototype to the extracted
code.

Location:
extracted/untrusted
Files:
1 added
1 moved

Legend:

Unmodified
Added
Removed
  • extracted/untrusted/Fix.ml

    r2736 r2738  
    1212(**************************************************************************)
    1313
    14 module MyList = struct
    15 let rec rev_append l1 l2 =
    16   match l1 with
    17     [] -> l2
    18   | a :: l -> rev_append l (a :: l2)
    19 
    20 let rev l = rev_append l []
    21 
    22 let find_all p =
    23   let rec find accu = function
    24   | [] -> rev accu
    25   | x :: l -> if p x then find (x :: accu) l else find accu l in
    26   find []
    27 
    28 let filter = find_all
    29 
    30 let rec map f = function
    31     [] -> []
    32   | a::l -> let r = f a in r :: map f l
    33 
    34 let rec iter f = function
    35     [] -> ()
    36   | a::l -> f a; iter f l
    37 end
    38 
    3914(* -------------------------------------------------------------------------- *)
    4015
     
    203178
    204179  let predecessors (node : 'data node) : 'data node list =
    205     let predecessors = MyList.filter (fun edge -> not edge.destroyed) node.incoming in
     180    let predecessors = OcamlList.filter (fun edge -> not edge.destroyed) node.incoming in
    206181    node.incoming <- predecessors;
    207     MyList.map (follow node) predecessors
     182    OcamlList.map (follow node) predecessors
    208183
    209184  (* [link src dst] creates a new edge from [src] to [dst], together
     
    237212
    238213  let clear_successors (node : 'data node) : unit =
    239     MyList.iter (fun edge ->
     214    OcamlList.iter (fun edge ->
    240215      assert (not edge.destroyed);
    241216      edge.destroyed <- true;
     
    362337
    363338let signal subject =
    364   MyList.iter (fun observer ->
     339  OcamlList.iter (fun observer ->
    365340    Graph.clear_successors observer;
    366341    Workset.insert observer
Note: See TracChangeset for help on using the changeset viewer.