Inverted index: Difference between revisions

m
(Added Erlang)
Line 1,645:
List.iter (fun (w, from) -> Hashtbl.replace h w from) inv_index;
List.iter (fun w ->
iflet Hashtbl.memfrom h w=
let from =try Hashtbl.find h w in
then begin
except Not_found -> []
let from = Hashtbl.find h w in
in
Hashtbl.replace h w (i::from)
end else
Hashtbl.add h w [i]
) words;
Hashtbl.fold (fun w from acc -> (w, from) :: acc) h []
Line 1,688 ⟶ 1,687:
| "--search-word", word -> search_word word
| _ -> usage()</lang>
 
 
=={{header|Perl}}==
Anonymous user