Advertisement
Guest User

Untitled

a guest
Sep 18th, 2015
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.41 KB | None | 0 0
  1. open Core.Std
  2.  
  3. module T = struct
  4.   type t = int with sexp
  5.   let compare = compare
  6.   let hash = Hashtbl.hash
  7. end
  8.  
  9. include T
  10.  
  11. let counter = ref 1
  12.  
  13. let reset () = counter := 1
  14. let create () =
  15.   let t = !counter in
  16.   let () = counter := !counter + 1 in
  17.   t
  18.  
  19. let name t = "%t" ^ string_of_int t
  20. let compare a b = compare a b
  21.  
  22. let format ff t = Format.fprintf ff "%s" (name t)
  23.  
  24. include Comparable.Make(T)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement