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

About this Entry

This page contains a single entry by zenspider published on September 4, 2006 1:31 AM.

RubyInline Myths was the previous entry in this blog.

ERB made faster (by about 40%?) is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.32-en