From: Alex Young Date: 2007-10-22T19:36:28+09:00 Subject: Re: Self-replicating Ruby Aaron Patterson wrote: > On Mon, Oct 22, 2007 at 11:25:02AM +0900, Frank J. Lhota wrote: >> Dear Ruby fans, >> >> A common Lisp exercise is to write a Lisp program that writes its own >> source code to standard output. Reading from a source file is not >> permitted. >> >> This leads one to wonder: what is the smallest and / or most elegant >> Ruby program that writes its own source code to standard output? As >> with Lisp, reading from a file is not permitted. Given the nature of >> the language, this problem should should have a lot of interesting >> solutions. > > This is called a Quine, right? I can't beat Ryan Davis', so I'll just > link to it. :-) > > http://blog.zenspider.com/archives/2006/09/ruby_quine__sli.html > I did one in ERb, too: <%=s=">%\"}esrever.s{#}tcepsni.s{#=s=%<\";";"<%=s=#{s.inspect}#{s.reverse}"%> -- Alex