mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
simpler Univ.unpack implementation
This commit is contained in:
parent
93eb787082
commit
73073bdd0c
1 changed files with 4 additions and 6 deletions
10
univ.ml
10
univ.ml
|
|
@ -49,12 +49,10 @@ let embed () =
|
|||
{ id = id; store = (fun () -> r := o); }
|
||||
in
|
||||
let unpack t = (* try to extract the content of a univ cell *)
|
||||
if id == t.id then begin
|
||||
t.store ();
|
||||
let a = !r in
|
||||
r := None;
|
||||
a
|
||||
end else None
|
||||
r := None;
|
||||
t.store ();
|
||||
let a = !r in
|
||||
a
|
||||
in
|
||||
let set t a = (* change, in place, the embedding and content of the cell *)
|
||||
t.id <- id;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue