On Jul 13, 9:35 am, James Gray <ja... / grayproductions.net> wrote:
> On Jul 13, 2008, at 10:17 AM, Alex LeDonne wrote:
>
> > My golfed solutions (with whitespace for readability):
>
> > def symbolify_1(i)
> >    # natural numbers only
> >    "??-??" + "-?(--?)" * i
> > end
>
> Mine was similar to this:
>
>    def symbolify(n)
>      "??-??" + "--(?)-?()" * n
>    end
>
> James Edward Gray II

I had similar solutions (but a smidge longer).  Here are some
cheaters:

  # Fix up muliplication so that it just returns the passed
  # number.  Every integer is encoded as '?**?*'. Fails the
  # deylayed eval test.
  def symbolify_m(i)
    Fixnum.class_eval <<-EOD
      def *(other)
        #{i}
      end
    EOD
    '?**?*'
  end


  # Fix up eval so that it just returns the passed argument.
  # Every integer is encoded as the empty string.  Fails the
  # delayed eval test.  Aliased so that you can still use irb.
  def symbolify_e(i)
    Kernel.class_eval <<-EOD
      alias_method :cheated_eval, :eval
      def eval(*args)
        if args.size == 1 and args.first == ''
          #{i}
        else
          cheated_eval(*args)
        end
      end
    EOD
    ''
  end

Chris