|
22 | 22 | @author Raphaël Proust (adding timers) |
23 | 23 | *) |
24 | 24 |
|
25 | | -let ( >>= ) = Lwt.bind |
| 25 | +open Lwt.Infix |
26 | 26 |
|
27 | 27 | module Dlist : sig |
28 | 28 | type 'a t |
@@ -66,12 +66,6 @@ module Dlist : sig |
66 | 66 | (** fold over the elements from the cache starting from the oldest |
67 | 67 | to the newest *) |
68 | 68 |
|
69 | | - val lwt_fold : ('b -> 'a -> 'b Lwt.t) -> 'b -> 'a t -> 'b Lwt.t |
70 | | - (** lwt version of fold *) |
71 | | - |
72 | | - val lwt_fold_back : ('b -> 'a -> 'b Lwt.t) -> 'b -> 'a t -> 'b Lwt.t |
73 | | - (** lwt version of fold_back *) |
74 | | - |
75 | 69 | val move : 'a node -> 'a t -> 'a option |
76 | 70 | (** Move a node from one dlist to another one, without finalizing. |
77 | 71 | If one value is removed from the destination list (because its |
@@ -322,34 +316,6 @@ end = struct |
322 | 316 | (match node.mylist with None -> () | Some l -> remove' node l); |
323 | 317 | match add_node node l with None -> None | Some v -> remove v; Some v.value |
324 | 318 |
|
325 | | - (* fold over the elements from the newest to the oldest *) |
326 | | - let lwt_fold f accu {newest; _} = |
327 | | - match newest with |
328 | | - | None -> Lwt.return accu |
329 | | - | Some newest -> |
330 | | - let rec fold accu node = |
331 | | - f accu node.value >>= fun accu -> |
332 | | - match node.prev with |
333 | | - | None -> Lwt.return accu |
334 | | - | Some new_node when new_node == newest -> Lwt.return accu |
335 | | - | Some new_node -> fold accu new_node |
336 | | - in |
337 | | - fold accu newest |
338 | | - |
339 | | - (* fold over the elements from the oldest to the newest *) |
340 | | - let lwt_fold_back f accu {oldest; _} = |
341 | | - match oldest with |
342 | | - | None -> Lwt.return accu |
343 | | - | Some oldest -> |
344 | | - let rec fold accu node = |
345 | | - f accu node.value >>= fun accu -> |
346 | | - match node.succ with |
347 | | - | None -> Lwt.return accu |
348 | | - | Some new_node when new_node == oldest -> Lwt.return accu |
349 | | - | Some new_node -> fold accu new_node |
350 | | - in |
351 | | - fold accu oldest |
352 | | - |
353 | 319 | (* fold over the elements from the newest to the oldest *) |
354 | 320 | let fold f accu {newest; _} = |
355 | 321 | match newest with |
|
0 commit comments