Someone
public ruby v1 · immutableclass Stack def initialize() @stack = [] end def empty?() @stack.empty? end def length() @stack.length end def push(value) @stack.push(value) end def pop() @stack.pop() end def peek() @stack.last end def dup() @stack.push(@stack.last) end def swap() @stack[@stack.length - 1], @stack[@stack.length - 2] = @stack[@stack.length - 2], @stack[@stack.length - 1] if @stack.length >= 2 endend