Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re : [Caml-list] 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: Matthieu Wipliez <mwipliez@y...>
Subject: Re : [Caml-list] Hashtbl.find_all Stack overflow

have you tried using the functorial version with a suitable compare function (ie not ?
I don't know about the type of the keys, so it is just a guess...

Hope that helps,

----- Message d'origine ----
De : "" <>
À :
Envoyé le : Lundi, 11 Décembre 2006, 19h18mn 15s
Objet : [Caml-list] Hashtbl.find_all Stack overflow

I get a stack overflow with the following

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;

Only when Hashtbl.find_all is executed enough times.

Caml-list mailing list. Subscription management:
Beginner's list:
Bug reports:


Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses