My first version cheats a bit, but passes the tests. Converts the num
to base-5 and back.
def symbolify(num)
def eval(str)
str.tr('(?*)-', '01234').to_i(5)
end
num.to_s(5).tr('01234', '(?*)-')
end
My second solution cheats badly, failing the delayed eval test. Still,
it's a single line of length 42. :)
def symbolify(num)
def eval(str) $num end; $num = num; "()"
end
I need to finish my non-cheating version...