Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. open Thread
  2. open Event
  3.  
  4. let rec tmap f ls =
  5. let c = new_channel () in match ls with
  6. | [] -> []
  7. | h::t -> let _ = create (fun c -> sync (send c (f h :: tmap f t))) c in
  8. sync (receive c)
  9.  
  10. # tmap (fun a -> a + a) [1;2;3;4;5;6];;
  11. - : int list = [2; 4; 6; 8; 10; 12]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement