class Hamster::Stack

def clear

def clear
  EmptyStack
end

def empty?

def empty?
  @list.empty?
end

def eql?(other)

def eql?(other)
  instance_of?(other.class) && @list.eql?(other.instance_variable_get(:@list))
end

def initialize

def initialize
  @list = EmptyList
end

def inspect

def inspect
  @list.inspect
end

def peek

def peek
  @list.head
end

def pop

def pop
  list = @list.tail
  if list.empty?
    EmptyStack
  else
    transform { @list = list }
  end
end

def push(item)

def push(item)
  transform { @list = @list.cons(item) }
end

def size

def size
  @list.size
end

def to_a

def to_a
  @list.to_a
end

def to_ary

def to_ary
  @list.to_ary
end