S
Siep Korteling
I've just reinvented the recursive array.
a = ["a rose is "]
a << a
Expecting the end of the world, or at least my ruby session, I did:
a.flatten!
But flatten! was just waiting for idiots like me and returned a polite
error. Investigating my unflattened array I found something strange.
p a[1][1][1][0]
=>a rose is
p a[0]
=> a rose is
p a[0][0]
=>97
Huh? I expected nil.
p a[0][0][0]
=>1
and it keeps returning 1's as far as I can see. Is this a bug or am I
just being silly?
Regards,
Siep
a = ["a rose is "]
a << a
Expecting the end of the world, or at least my ruby session, I did:
a.flatten!
But flatten! was just waiting for idiots like me and returned a polite
error. Investigating my unflattened array I found something strange.
p a[1][1][1][0]
=>a rose is
p a[0]
=> a rose is
p a[0][0]
=>97
Huh? I expected nil.
p a[0][0][0]
=>1
and it keeps returning 1's as far as I can see. Is this a bug or am I
just being silly?
Regards,
Siep