If you'd like to know what a quine is, here's a short definition and a lengthy discussion. There are many other lists of quines - here's one. This particular list is composed entirely of quines written by me.
| Language | Properties | Notes | Program |
|---|---|---|---|
| Common Lisp | print, circle | 2005-12-16 |
|
| repl, circle | 2009-07-28 Getting dangerously close to “trivial” |
| |
| Haskell | repl, quoting |
| |
| 2006-11-27 Point-free version of the above |
| ||
| MOO-Code | repl, quoting |
| |
| Python | repl, quoting |
| |
| repl, quoting |
| ||
| repl, quoting |
| ||
| print, eval, quoting |
| ||
| E | repl, quoting |
| |
| print, quoting |
| ||
| print, quoting | Shortest E quine I know of. |
| |
| print, quoting | The above without using lists as a trick to force quoting. |
| |
| print, quoting |
| ||
| print, quoting |
| ||
| Unlike all the above E quines, does its own quoting. |
| ||
| Perl 5 | print, meta | Uses require and a quoted package name because B::Deparse cannot reproduce use statements. |
|
| print, eval, nesting |
$_=q{print"\$_=q{$_};eval\n"};eval
| ||
| print, nesting |
(printf((q((printf((q(%s))x2))))x2)) | ||
| print, nesting | There must be a blank line at the end of the source. |
die<<''x2,$/ die<<''x2,$/ | |
| print, nesting |
$_=q{$_=q{X};s/X/$_/;print};s/X/$_/;print
| ||
| print, cycle, eval | This is actually the 'seed' program - it is outside of the cycle, but produces a program in the cycle when run. |
$_=q{%_=map{$_,1}45,123,125,92;$"=$,;sub r{
my (@t, $f) = grep !$_{$_}, (32..126);
unshift @t, splice @t, shift @_; push @t,
-1; my ($aa, $bb) = ($t[0], 1+shift @t);
for ($bb++; defined (my $this = shift @t); $bb++)
{ next if $this == $bb;
$f .= chr($aa) . ("-" . chr($bb-1))
x ($aa != $bb-1);
$aa = $bb = $this;}"{$f}"}
s/(r\(-?)(\d+)\)/$1.($2+1).')'/ge;eval'y'.r.r(1);
print"\$_=q{$_}; y".r.r(-1).";eval;print\$@\n"
}; eval;print$@
| |
| print, cheating | These are not strictly quines, and are only included to make this my complete collection of quinelike programs. |
open 0;print<0> | |
| print, cheating |
seek DATA,0,0;print<DATA>__END__ | ||
| print, cheating, eval |
#!/usr/bin/perl -w-e 'open ${-%{$@}};print'
$_=q=_=;s##scalar((($_='!;_$$,!$_!;') =~
tr@_$;!,@=",$;@),$_)#ee;eval "@{[reverse
split+/[1-9]/, '>1A2T3A5D4<6 7t8in1r2p2;4'
.'05,801,8A9AT3k D5e6e7s8']}" __END__
| ||
| print, cheating, eval |
#!perl -w-e'seek DATA, 0, 0; print <DATA>' $_=q;\;0+nepo; ;$_?$_:$!=s;(.*);(join+q.., reverse+split+m++,$1).q.print<0>.;see? 00:01 |
Definition of properties: