From: Joseph McDonald Date: 2002-03-19T15:10:08+09:00 Subject: Re: Wanted: slick rubyesqe algorithm BC> On second thought, it could be shorter and probably shouldn't be BC> destroy the incoming array... BC> def weird_compress2 from, to=[] BC> return to if from.size == 0 BC> t, from = from[0], from[1..-1] BC> t = (to.pop + t) if (to.last.is_a? String) && (t.is_a? String) BC> weird_compress2 from, to.push t BC> end BC> a = [ "AB","CD",:alpha,"DE",:beta,:gamma,"FG","HI"] BC> p weird_compress2(a) BC> Clear as mud. Clear as mud to us folks that struggle with recursion. I always try to find a non-recursive method of solving a problem because recursion just doesn't "click" with me. I can usually follow the logic with effort, but it doesn't come natural. -joe