Commit 75ccaa39 authored by POTTIER Francois's avatar POTTIER Francois

Implement [visit_list] in [mapreduce].

parent be607a7d
......@@ -511,10 +511,21 @@ end
(* [mapreduce] *)
class virtual ['self] mapreduce = object (_self)
class virtual ['self] mapreduce = object (self : 'self)
inherit ['z] monoid
method private visit_list: 'a 'b .
('env -> 'a -> 'b * 'z) -> 'env -> 'a list -> 'b list * 'z
= fun f env xs ->
match xs with
| [] ->
[], self#zero
| x :: xs ->
let x, zx = f env x in
let xs, zxs = self # visit_list f env xs in
x :: xs, self#plus zx zxs
(* TEMPORARY *)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment