Struct

module ListStack = struct
  (** [empty] is the empty stack. *)
  let empty = []
 
  (** [is_empty s] is whether [s] is empty. *)
  let is_empty = function [] -> true | _ -> false
 
  (** [push x s] pushes [x] onto the top of [s]. *)
  let push x s = x :: s
 
  (** [Empty] is raised when an operation cannot be applied
      to an empty stack. *)
  exception Empty
 
  (** [peek s] is the top element of [s].
      Raises [Empty] if [s] is empty. *)
  let peek = function
    | [] -> raise Empty
    | x :: _ -> x
 
  (** [pop s] is all but the top element of [s].
      Raises [Empty] if [s] is empty. *)
  let pop = function
    | [] -> raise Empty
    | _ :: s -> s
end
 
ListStack.push 2 (ListStack.push 1 ListStack.empty)