sabbyxtabby
10/18/2003 3:30:00 PM
henon <meinrad.recheis@gmx.at> wrote:
> i have created this quine of length 32 and i believe that a
> nonzero-ruby-quine cannot be shorter and more in the spirit of ruby than
> that:
>
> eval s=%q(puts"eval s=%q(#{s})")
>
> until anyone comes up with a shorter nonzero quine i claim this to be
> the shortest nonzero-ruby-quine.
Well, technically, your quine is 33 characters in length; the output
includes a "\n" at the end, so the source must also. Using a global
variable shortens it by one character:
eval$s=%q(puts"eval$s=%q(#$s)")
A Ruby version of Robin Houston's Perl quine is 31 characters:
puts <<''*2,''
puts <<''*2,''
Note that there is a blank line (or two "\n") at the end.