Source

OCaml Map Reduce Project / apps / inverted_index / reducer.ml

Full commit
1
2
3
4
5
6
7
let (key, values) = Program.get_input() in
let helper acc v =
  match acc with
  | [] -> [v]
  | h::t -> if v = h then acc else v::acc in
let indices = List.fold_left helper [] values in
    Program.set_output [string_of_int sum]