From: Mike Stok Date: 2001-09-01T11:01:37+09:00 Subject: [ruby-talk:20653] Re: ruby quine On Sat, 1 Sep 2001, John Tromp wrote: > The web page > http://www.nyx.net/~gthompso/quine.htm > > shows self-reproducing programs, aka "quine"s for many languages, > but Ruby is conspicuously missing. > What would be the shortest Ruby program to output itself? > > I don't suppose it could be as short as in python? : > l='l=%s;print l%%`l`';print l%`l` Is the program between the quotes legal :-) [mike@ratdog mike]$ ruby -e '' > prog [mike@ratdog mike]$ ls -l prog -rw-r--r-- 1 mike mike 0 Aug 31 21:59 prog [mike@ratdog mike]$ ruby prog > prog2 [mike@ratdog mike]$ diff prog prog2 [mike@ratdog mike]$ Mike -- mike@stok.co.uk | The "`Stok' disclaimers" apply. http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA | Fingerprint 0570 71CD 6790 7C28 3D60 | 75D2 9EC4 C1C0 0599 13DA