From: "David A. Black" Date: 2008-05-05T21:38:52+09:00 Subject: Re: Different Ways To Loop Hi -- On Mon, 5 May 2008, Marc Heiler 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) + ((212-32)*5/9).to_s)].pack(%{#{"".class.class.name[0].chr}*}).unpack("#{'B'.succ}*") 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. David -- Rails training from David A. Black and Ruby Power and Light: INTRO TO RAILS June 9-12 Berlin ADVANCING WITH RAILS June 16-19 Berlin INTRO TO RAILS June 24-27 London (Skills Matter) See http://www.rubypal.com for details and updates!