#resultz, not necessarily in this order:
["0000","0001","0010","0011","0100","0101","0110","0111","1000","1001","1010","1011","1100","1101","1110","1111"]
Important to my use: This binary_seq_generator method must be written
in such a way so that each subsequent member of the resultz array would
be completely generated before the next member starts. This is where
I'm stuck. I have trying manipulating the graycode algorithm here: http://yagni.com/graycode/
This graycode algorithm seems to produce an array where each member is
only finalized on the final recurse. I may be wrong...but by this
method, I can't use resultz[i] for something before the algorithm starts
to build resultz[i+1], and I need to use each member of the resultz
array before moving on to the next binary string in the sequence.
#resultz, not necessarily in this order:
["0000","0001","0010","0011","0100","0101","0110","0111","1000","1001","1010","1011","1100","1101","1110","1111"]
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.
David
···
On Mon, 10 Aug 2009, Tom Best wrote:
--
David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com
Q: What's the best way to get a really solid knowledge of Ruby?
A: Come to our Ruby training in Edison, New Jersey, September 14-17!
Instructors: David A. Black and Erik Kastner
More info and registration: http://rubyurl.com/vmzN
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.
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<<n).times.map{ | d | "%0{n}b" % d }
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/\.
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<<n).times.map{ | d | "%0{n}b" % d }
Good idea -- I was definitely doing an extra round trip to binary
David
--
David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com
Q: What's the best way to get a really solid knowledge of Ruby?
A: Come to our Ruby training in Edison, New Jersey, September 14-17!
Instructors: David A. Black and Erik Kastner
More info and registration: http://rubyurl.com/vmzN