in reply to Re: Brace For This
in thread Brace For This

You're very close, but you forgot or missed an important detail:

You are generating the character index from the number of sub-arrayrefs and elements counted recursively.

At the risk of being pedantic, not exactly :-)

   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Replies are listed 'Best First'.
Re: Re: Re: Brace For This
by jmcnamara (Monsignor) on Apr 29, 2001 at 18:47 UTC

    At the risk of being pedantic, not exactly

    You are right. I should have been more explicit.

    The algorithm is a binary encoding of the ordinal values of the characters based on the accumulated level of recursion. For example the letter "J" is encoded as follows:
    [ [[[[]]], [[]]], [[[]], []], [[]] ] Adding brackets to highlight the nesting of the arrayrefs: [ ([ ([[[ ]]]) , ([[ ]])) ]), ([ ([[ ]]) , ([ ]) ]), ([ ([ ] +) ]) ] 4 2 2 1 1 This gives: = 2**(4+2) +2**(2+1) +2**(1) = 2**(6) +2**(3) +2**(1) = 1001010b = 74 = ord('J');
    Clever and artistic. ;-)

    John.
    --