I would like to write a pseudo version of
List.map with the help of the
open Thread open Event let rec tmap f ls = let c = new_channel () in match ls with |  ->  | h::t -> let _ = create (fun c -> sync (send c (f h :: tmap f t))) c in sync (receive c)
Calling the func:
# tmap (fun a -> a + a) [1;2;3;4;5;6];; - : int list = [2; 4; 6; 8; 10; 12]
How can I make it smarter? In my case, I'm creating a thread for every list element, so if I had 10k elements this would be bad. My guess it that I should split the list, but how is it usually done?