"Florian Gross" <flgr / ccan.de> wrote:
> Dave Burt wrote:
>
>> You can see my solution at http://www.dave.burt.id.au/ruby/lcd_digits.rb
>>
>> I used two functions, one to turn something like '9' into a big ASCII-art 
>> digital-looking 9, and one like UNIX's paste command to stick them next 
>> to each other.
>
> Your solution is very similar to mine. We both represented the number 
> faces via bit masks and decided to first render the individual digits and 
> then stick them next to each other.
>
> I'm keeping the lines of a digit as an Array and sticking them together 
> with this code:
>
> ary.transpose.map do |line|
>   line.join(" ")
> end.join("\n")
>
> Maybe that would also be an option for you.

My newsreader missed your post :(
I was able to read it on ruby-talk.com via the Ruby Quiz site (which is 
pretty cool for all its failings) :)

Sticking together like this?

def paste(array_of_strings, delim = ' ')
  array_of_strings.map {|s| s.split(/\n/)}.transpose.map do |line|
    line.join(delim)
  end.join("\n")
end

Yes, that's neater than my paste(), and plugs right in. These strings all 
have the same number of lines, so it doesn't matter that it fails if they 
don't.

It's an interesting one. The process we used seemed to me to be the obvious 
one, yet everyone's come up with a different way, stretching, golfing, etc.

I should also borrow your comments for my bitmask hash.

Cheers,
Dave