On Feb 11, 4:40 pm, James Edward Gray II <j... / grayproductions.net>
wrote:
> quiz.to_s.reverse.gsub(/(\d\d\d)(?=\d)(?!\d*\.)/,"\\1,").reverse
> quiz.inject(Array.new) { |arr, a| arr.push(*a) }
> quiz.sort_by { rand }
> quiz.split("::").inject(Object) { |par, const| par.const_get(const) }
> quiz.gsub!(/(.{1,40}|\S{41,})(?: +|$\n?)/, "\\1\n")
> quiz.select { |w| w.split("").sort == quiz.first.split("").sort }
> quiz.split("").map { |c| c == " " ? "\n" : c[0].to_s(2) }.join
> quiz.inject { |choice, line| rand < 1/quiz.lineno.to_f ? line : choice }
> Hash.new{|h, n| n==1 ? [1] : [n] + h[n%2 == 0 ? n/2 : n*3+1] }[quiz]
> quiz.reverse.inject { |res, wrap| {wrap => res} }

What I particularly admire about your solutions is that they are all
single- or chained-statements. None of the "a=[];...;a" nonsense that
I mucked about with. I wish I had been sure that it was possible to do
this for all solutions, so that I would have looked harder.

I can't tell if I think the reverse/regexp/reverse technique you (and
many others) used for the first problem is more or less elegant than a
single regexp on the integer portion. I suspect that mine is faster at
runtime...but speed is rarely an appropriate measure of elegance.

Kudos on the memoizing wondrous number, btw. :)