From: "Tom B." Date: 2009-08-10T04:14:59+09:00 Subject: Re: Generate binary sequences of length n? Robert Dober wrote: > On Sun, Aug 9, 2009 at 8:32 PM, David A. Black > wrote: >>> >> >> Try this: >> >> def binary_seq_generator(n) >>  (0...(1 << n)).map {|e| "%0#{n}d" % e.to_s(2) } >> end >> >> Doesn't necessarily roll off the fingers as readily as some Ruby >> idioms do :-) But I think all or most of what you need is there, and >> there are some interesting bits to it. > Well 1.9 has to offer some elegance here > > (1< > HTH > Robert They worked! Thank you both very much - having a comprehensive understanding of these operators will move my coding to the next level! Very much appreciated, Tom -- Posted via http://www.ruby-forum.com/.