class Hamster::Stack
def dup
def dup self end
def empty?
def empty? @list.empty? end
def eql?(other)
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
def pop copy = @list.cdr if !copy.equal?(@list) self.class.new(copy) else self end end
def push(item)
def push(item) self.class.new(@list.cons(item)) end
def size
def size @list.size end
def top
def top @list.car end