Share on Facebook Share on Twitter Email
Answers.com

Quine

 

[from the name of the logician Willard van Orman Quine, via Douglas Hofstadter] A program that generates a copy of its own source text as its complete output. Devising the shortest possible quine in some given programming language is a common hackish amusement. (We ignore some variants of BASIC in which a program consisting of a single empty string literal reproduces itself trivially.) Here is one classic quine:

 ((lambda (x) (list x (list (quote quote) x))) (quote (lambda (x) (list x (list (quote quote) x))))) 

This one works in LISP or Scheme. It's relatively easy to write quines in other languages such as Postscript which readily handle programs as data; much harder (and thus more challenging!) in languages like C which do not. Here is a classic C quine for ASCII machines:

 char*f="char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c"; main(){printf(f,34,f,34,10);} 

For excruciatingly exact quinishness, remove the interior line breaks. Here is another elegant quine in ANSI C:

 #define q(k)main(){return!puts(#k"\nq("#k")");} q(#define q(k)main(){return!puts(#k"\nq("#k")");}) 

Some infamous Obfuscated C Contest entries have been quines that reproduced in exotic ways. There is an amusing Quine Home Page.


Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
WordNet: Quine
Top
Note: click on a word meaning below to see its connections and related words.

The noun has one meaning:

Meaning #1: United States philosopher and logician (1908-)
  Synonym: Willard Van Orman Quine


 
 
Learn More
nitroquinol
Basic (1984 Album by Robert Quine with Fred Maher)
Quine, Willard van Orman (American analytic philosopher and logician)

What does 'Quin est loco' mean? Read answer...
When Quin of zoey101 is on the computer she is on what website? Read answer...
Is Tegan Quin Single? Read answer...

Help us answer these
Who is quin sykes?
What comes after quin?
Did Glen Quin die?

Post a question - any question - to the WikiAnswers community:

 

Copyrights:

Hacker Slang. The Jargon File. Copyright © 2007.  Read more
WordNet. WordNet 1.7.1 Copyright © 2001 by Princeton University. All rights reserved.  Read more