spacepaste

  1.  
  2. type 'a t = 'a option ref
  3. let create () = ref None
  4. let init v = ref (Some v)
  5. let of_option = ref
  6. let reify v f = match !v with
  7. | Some v' -> v'
  8. | None ->
  9. let v' = f () in
  10. v := Some v';
  11. v'
  12.