SHARE
TWEET

Untitled

a guest Jun 17th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module type STACK =
  2. sig
  3.     type element
  4.     type stack
  5.     val empty : stack
  6.     val push : element -> stack -> stack
  7.     val pop : stack -> element*stack
  8.     val to_list : stack -> element list
  9. end
  10.  
  11. module type IMP =
  12. sig
  13.     type t
  14. end
  15.  
  16. module ListStack(M : IMP) : STACK with type element = M.t =
  17. struct
  18.     type element = M.t
  19.     type stack = element list
  20.     let empty = []
  21.     let push x s = x :: s
  22.     let pop (x :: xs) = (x, xs)
  23.     let to_list s = s
  24. end
  25. module S = ListStack(
  26.         struct
  27.         type t = int
  28.         end
  29.     )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top