Advertisement
Guest User

Untitled

a guest
Apr 10th, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.43 KB | None | 0 0
  1. (**
  2.  * Create a Tellstory module were dice will return results from dice_results
  3.  *
  4.  * @param dice_results  int list
  5.  * @return Tellstory module
  6.  *)
  7. let make_module dice_results =
  8.   let dice_calls = ref 0 in (* nr of times dice has been called *)
  9.   let module T = Tellstory.Make(struct
  10.     let dice n =
  11.       let result = List.nth dice_results (!dice_calls) in
  12.       dice_calls := !dice_calls + 1;
  13.       result
  14.   end)
  15.   in T
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement