susu #6303(2008/05/19 06:49 GMT) [ OCaml ] Rating0/0=0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
type 'a t = 'a option ref let mkvar () = (ref None:'a t) let get (x:'a t) = !x let set_normal (x:'a t) y = (x := Some y) let set_defor (x:'a t) y = match !x with | None -> x := Some y | Some _ -> () let (//=) = set_defor;; (* let x = mkvar ();; x //= 1; get x;; (* Some 1*) x //= 2; get x;; (* Some 1*) *)
Rating0/0=0.00-0+
[ reply ]
susu
#6303()
[
OCaml
]
Rating0/0=0.00
Rating0/0=0.00-0+
[ reply ]