Guest User

Untitled

a guest
Feb 11th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.75 KB | None | 0 0
  1.  
  2. (* ------------------------------------------------------------------------- *)
  3. (* Polymorphic finite partial functions via Patricia trees.                  *)
  4. (*                                                                           *)
  5. (* The point of this strange representation is that it is canonical (equal   *)
  6. (* functions have the same encoding) yet reasonably efficient on average.    *)
  7. (*                                                                           *)
  8. (* Idea due to Diego Olivier Fernandez Pons (OCaml list, 2003/11/10).        *)
  9. (* ------------------------------------------------------------------------- *)
  10.  
  11. type ('a,'b)func =
  12.    Empty
  13.  | Leaf of int * ('a*'b)list
  14.  | Branch of int * int * ('a,'b)func * ('a,'b)func;;
Add Comment
Please, Sign In to add comment