From: Alex LeDonne Date: 2008-07-12T03:27:29+09:00 Subject: Re: Symbolify (#169) On Fri, Jul 11, 2008 at 1:57 PM, Chris Shea wrote: > On Jul 11, 10:41 am, Alex LeDonne wrote: >> On Fri, Jul 11, 2008 at 12:12 PM, ara.t.howard wrote: >> >> > On Jul 11, 2008, at 9:17 AM, Matthew Moss wrote: >> >> >> That is, the following test code should raise no exceptions: >> >> >> 1000.times do |i| >> >> s = symbolify(i) >> >> raise "Not a string!" unless s.is_a? String >> >> raise "Invalid chars!" unless s.delete("?*()-").empty? >> >> >> x = eval(s) >> >> raise "Decode failed!" unless i == x >> >> end >> >> > i've got one line - tests pass. >> >> Me too. My method body is one line, 25 characters. Did you manage to >> stretch yours to 42? :) >> >> -A > > And it works for negative integers too? > > Chris Hmm... that wasn't in the tests. That took 46 characters (so far) for my golfed solution. -A