Mutually-Recursive Functions

[snip]

    return alpha_col[0] - 'A'[0] + 1

[snip]

I thought I'd point out that
  'A'[0]
is equivalent to
  ?A
...and I personally find the latter to be much more friendly.

For completeness, here's how I'd write the name-to-number conversion as
an auto-caching hash (without the bounds tests):

COL_NUM = Hash.new{ |h,alpha|
  offset = ?A - 1
  alpha.upcase!
  case alpha.size
    when 1
      h[alpha] = alpha[0] - offset
    when 2
      h[alpha] = ( alpha[0] - offset ) * 26 +
                 ( alpha[1] - offset )
  end
}

···

From: bbiker [mailto:renard@nc.rr.com]
Sent: Thursday, June 07, 2007 12:00 PM