# A bit of fun to while away a boring afternoon
class Fixnum  def prev    self - 1  endend
def add a, b  return a if b.zero?  if b > 0    add a.succ, b.prev  else    add a.prev, b.succ  endend
def leval(args) return args unless args.is_a? Array args.map!{|a|  if a.is_a? Array    leval a  else    a  end } op, *args = args functions[op][args]end
def functions  {    :if => lambda{|args| if leval(args.first) then args[1] else args[2] end },    :zero? => lambda{|args| not (args.first > 0 or args.first < 0) },    :+ => lambda{|args| args.inject{|s,i| add s, i}},    :- => lambda{|args| args.inject{|s,i| add s, -i}}  }end
p leval([[:if, [:zero?, 0], :+, :-], 3,4])