On Mon, 5 May 2008, Marc H. wrote:
Hmm, the example with p *1…100 surprised me, I knew the * but I somehow
havent seen this used in such a short way
I guess fun examples would be that noone notices that a loop is a
work… isn’t there an obfuscated way with Array(pack/unpack)?
I think there are infinite obfuscated ways. It depends what you
consider a “way” to print the integers 1 to 100. You can surround it
with unintelligible garbage, encrypt it and then unencrypt and eval
it, and so forth.
It’s an interesting question: what’s the horizon of a “way” to do
something, using “way” as in “Ruby gives you different ways to do
xyz”? I don’t believe that the relation between, say, p *1…100 and
puts [1,2,3,…,100] is the same as the relation between either of
those ways of printing integers and
puts [eval(“1” + (("$%#$&."[-1,1]) * 2) +
or whatever. That prints the numbers but I don’t think it can usefully
be described as a “way” to print an array of integers.