ruby quine _slightly_ smaller than python quine

| | Comments (0)

I found Shortest Python Quine? and thought I'd check it out. I wasn't aware of python's %r, but apparently it is equivalent to our %p (which I always forget about). Anyhow, here is our version:

% ruby quine.rb 
_="_=%p;puts _%%_";puts _%_
% ruby quine.rb | ruby
_="_=%p;puts _%%_";puts _%_

or eric's morph:

% echo '_="_=%p;puts _%%_";puts _%_' | ruby | ruby
_="_=%p;puts _%%_";puts _%_

Comes in at 28 characters, and ties the shortest on rubygarden.

Leave a comment