ara.t.howard
6/7/2007 1:32:00 PM
On Jun 7, 2007, at 5:06 AM, dblack@wobblini.net wrote:
> Hi --
>
> On Thu, 7 Jun 2007, Harry Kakueki wrote:
>
>> On 6/7/07, Revence Kalibwani <revence27@gmail.com> wrote:
>>> # That is, of course, a silly way to implemet even and odd.
>>> So, let me give you the problem
>>> # I was trying to solve.
>>> #
>>> # To generate the lettering similar to that above the
>>> spreadsheet columns, where the first
>>> # column has 'A', the second 'B' ... the twenty-sixth 'Z'.
>>> Then, the twenty-seventh has
>>> # 'AA', the twenty-eight has 'AB', and so on. This is
>>> recursive by nature. Here is what
>>> # should work:
>>
>> I may be missing something, but..
>>
>> If you just want to do that then try something like this.
>>
>> arr = []
>> ("a".."ff").each {|x| arr << x}
>> p arr
>
> Work-saving tip for the day:
>
> p [*"a".."ff"]
>
> :-)
>
seems a bit perlish no?
cfp:~ > cat a.rb
p ('a' .. 'ff').to_a
cfp:~ > ruby a.rb
["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
"aa", "ab", "ac", "ad", "ae", "af", "ag", "ah", "ai", "aj", "ak",
"al", "am", "an", "ao", "ap", "aq", "ar", "as", "at", "au", "av",
"aw", "ax", "ay", "az", "ba", "bb", "bc", "bd", "be", "bf", "bg",
"bh", "bi", "bj", "bk", "bl", "bm", "bn", "bo", "bp", "bq", "br",
"bs", "bt", "bu", "bv", "bw", "bx", "by", "bz", "ca", "cb", "cc",
"cd", "ce", "cf", "cg", "ch", "ci", "cj", "ck", "cl", "cm", "cn",
"co", "cp", "cq", "cr", "cs", "ct", "cu", "cv", "cw", "cx", "cy",
"cz", "da", "db", "dc", "dd", "de", "df", "dg", "dh", "di", "dj",
"dk", "dl", "dm", "dn", "do", "dp", "dq", "dr", "ds", "dt", "du",
"dv", "dw", "dx", "dy", "dz", "ea", "eb", "ec", "ed", "ee", "ef",
"eg", "eh", "ei", "ej", "ek", "el", "em", "en", "eo", "ep", "eq",
"er", "es", "et", "eu", "ev", "ew", "ex", "ey", "ez", "fa", "fb",
"fc", "fd", "fe", "ff"]
;-)
-a
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama