Version française
Home     About     Download     Resources     Contact us    
Browse thread
Hashtbl.find_all Stack overflow
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: jhsu1@e...
Subject: Hashtbl.find_all Stack overflow

I get a stack overflow with the following

<PRE>
let var_lookup = Hashtbl.create 997;;

(* ... *)

let keys h = Hashtbl.fold (fun key data accu -> if not (List.mem key accu) then
key :: accu else accu) h [] in
	let files = keys var_lookup in
		let helper file = (let vars = Hashtbl.find_all var_lookup file in
		let run_tpl var = print_string var in
		List.iter run_tpl vars) in
		List.iter helper files;
</PRE>

Only when Hashtbl.find_all is executed enough times.