From: Robert Dober Date: 2007-04-11T16:58:55+09:00 Subject: Re: Getting to 100 (#119) On 4/11/07, Ken Bloom wrote: > On Mon, 09 Apr 2007 21:18:16 +0900, Rick DeNatale wrote: > > > On 4/8/07, Marcel Ward wrote: > >> On 08/04/07, Carl Porth wrote: > >> > After going back and reading the current solutions, I like Ken > >> > Bloom's each_partition method. It's much cleaner than my > >> > combinations method. > >> > >> I agree, very clean and efficient. The three lines that put it all > >> together using #zip are what makes this work for me: > >> > >> Digits.each_partition(Operators.length+1) do |digitspart| > >> OperatorPerms.each do |operatorsperm| > >> expression=digitspart.zip(operatorsperm).flatten.join > >> ... > >> > >> I think I would be feeling very happy if I'd submitted this solution :) > > > > May I have the temerity to point out that I posted basically the same > > solution, which I posted two hours before Ken's. > > I typically compose my solution on Friday afternoon, and sit on it for > two days before posting to ruby-talk. When I post on Sunday, I do so > before reading any other solutions out there. After posting, I browse the > solutions, marvel at the clever ones, and usually notice that a bunch of > people have come up with the same idiomatic solution as me, thereby > suggesting that: > 1) those people are also interested in clear idiomatic code > 2) I'm unlikely to be the one summarized. Cheer up Ken;) http://www.rubyquiz.com/quiz110.html > > --Ken > > -- > Ken Bloom. PhD candidate. Linguistic Cognition Laboratory. > Department of Computer Science. Illinois Institute of Technology. > http://www.iit.edu/~kbloom1/ > > -- You see things; and you say Why? But I dream things that never were; and I say Why not? -- George Bernard Shaw