From: Alan P. <ap...@re...> - 2003-06-08 11:10:08
|
Here's a little patch cleaning up Enum.append slightly from the previous one. --- enum.ml 2003/06/08 10:09:07 1.4 +++ enum.ml 2003/06/08 10:49:45 @@ -379,30 +379,26 @@ } and append_count = ref (fun () -> ta.count() + tb.count()) and append_clone = ref (fun () -> append (ta.clone()) (tb.clone())) - and append_next = ref _dummy + and append_next = ref _dummy in + let ta_done () = + append_count := tb.count; + append_clone := tb.clone; + append_next := tb.next; + e.fast <- tb.fast; + !append_next () in append_next := begin if ta.fast then (fun () -> match ta.count () with - | 0 -> - append_count := tb.count; - append_clone := tb.clone; - append_next := tb.next; - e.fast <- tb.fast; - !append_next () + | 0 -> ta_done () | _ -> ta.next ()) else (fun () -> try ta.next() with - No_more_elements -> - append_count := tb.count; - append_next := tb.next; - append_clone := tb.clone; - e.fast <- tb.fast; - !append_next ()) + No_more_elements -> ta_done ()) end; e.count <- (fun () -> !append_count ()); e.next <- (fun () -> !append_next ()); |