class Hamster::Stack

def clear

def clear
  EmptyStack
end

def dup

def dup
  self
end

def empty?

def empty?
  @list.empty?
end

def eql?(other)

def eql?(other)
  return true if other.equal?(self)
  return false unless other.class.equal?(self.class)
  @list.eql?(other.instance_eval{@list})
end

def initialize(list)

def initialize(list)
  @list = list
end

def inspect

def inspect
  @list.inspect
end

def pop

def pop
  list = @list.tail
  if list.empty?
    EmptyStack
  else
    self.class.new(list)
  end
end

def push(item)

def push(item)
  self.class.new(@list.cons(item))
end

def size

def size
  @list.size
end

def to_a

def to_a
  @list.to_a
end

def to_list

def to_list
  @list
end

def top

def top
  @list.head
end