On Jul 11, 2008, at 9:17 AM, Matthew Moss wrote:
>
> ## Symbolify (#169)
>



a full-on cheat:

cfp:~/src/ruby > cat a.rb
# impl
#
   def symbolify i;def (s=i.to_s).delete _;'';end;s;end

# test
#
   nums = (0...1000).sort_by { rand }
   strs = nums.map { |n| symbolify(n) }

   strs.zip(nums).sort_by { rand }.each do |str, num|
     res = eval(str)
     raise "Not a string!"  unless str.is_a? String
     raise "Invalid chars!" unless str.delete("?*()-").empty?
     raise "Decode failed!" unless res == num
   end

   puts "Passed!"



cfp:~/src/ruby > time ruby a.rb
Passed!

real	0m0.026s
user 0m0.021s
sys	0m0.005s


a @ http://codeforpeople.com/
--
we can deny everything, except that we have the possibility of being  
better. simply reflect on that.
h.h. the 14th dalai lama