class Hamster::Stack

def dup

Returns self
def dup
  self
end

def empty?

Returns true if the stack contains no items.
def empty?
  @list.empty?
end

def eql?(other)

Returns true if . eql? is synonymous with ==
def eql?(other)
  equal?(other) || (self.class.equal?(other.class) && @list.eql?(other.instance_eval{@list}))
end

def initialize(list = List.new)

def initialize(list = List.new)
  @list = list
end

def pop

Returns a copy of self without the top item.
def pop
  copy = @list.cdr
  if !copy.equal?(@list)
    self.class.new(copy)
  else
    self
  end
end

def push(item)

Returns a copy of self with the given item as the new top
def push(item)
  self.class.new(@list.cons(item))
end

def size

Returns the number of items on the stack.
def size
  @list.size
end

def top

Returns the item at the top of the stack.
def top
  @list.car
end