Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] queasiness about Exit
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Prevost <jprevost@p...>
Subject: Re: [Caml-list] queasiness about Exit
How about something like:

  let exists_in_complex_datastructure =
    let module M =
      struct
        exception Exit
        let eicd predicate complex_data_structure =
          try 
            map_for_effect_on_complex_data_structure
              (fun element -> if predicate element then raise Exit)
              complex_data_structure;
            false
          with Exit -> true
       end
     in M.eicd

That is, in the scope of your module (or within the function), create
a new exception for your use.  Since it's local to your function,
nobody else will be raising it.

John.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr