Skip to content

Instantly share code, notes, and snippets.

@fetburner
Created April 28, 2013 08:45
Show Gist options
  • Save fetburner/5476312 to your computer and use it in GitHub Desktop.
Save fetburner/5476312 to your computer and use it in GitHub Desktop.
module IntRef = struct
type t = int ref
let compare a b =
(* Obj.magic注意!無理やりintにしてアドレスを得ている *)
let a_address : int = Obj.magic a in
let b_address : int = Obj.magic b in
(* Pervasivesを付けるのは趣味 *)
Pervasives.compare a_address b_address
end
(* 物理的等価性を見るint refの集合 *)
module IntRefSet = Set.Make (IntRef)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment