Meaning of QUINE
|Matching Terms: || ||quin, quinacrine, quinacrine hydrochloride, quinaldine, quiname, quinaphthol, quinary, quinate, quinazol, quince, quince bush, quincentenary, quincentennial, quincewort, quinch, quincke's disease, quincuncial, quincuncially, quincunx, quincy, --quincy., quindecagon, quindecemvir, quindecemvirate, quindecone, quindecylic, quindem, quindism, quinestrol, quinhydrone, quinia, quinible, quinic, quinicine, quinidex, quinidine, quinine, quinine water, quininic, quininism, quinizarin, quinizine, quinnat, quinnat salmon, quinoa, quinogen, quinoidine, quinoline, quinologist, quinology, quinone, quinora, quinovic, quinovin, quinoxaline, quinoxyl, quinoyl, quinquagesima, quinquagesima sunday, quinquangular, quinquarticular, quinque-, quinque foliolate, quinqueangled, quinquedentate, quinquefarious, quinquefid, quinquefoliate, quinquefoliate leaf, quinqueliteral, quinquelobate, quinquelobed, quinquelocular, quinquenerved, quinquennalia, quinquennial, quinquennium, quinquepartite, quinquereme, quinquesyllable, quinquevalve, quinquevir, quinquina, quinquivalent, quinsy, quint, quintain, quintal, quintan, quintec-objects, quintel, quintessence, quintessential, quintet, quintette, quintic, quintile, quintillion, quintillionth, quintilllion, quintin, quintine, quintipara, quintole, quintroon, quintuple, quintuplet, quintuplets, quintupling, quintus prolog, quintus septimius florens tertullianus, quinzaine, quinze|
| ||Definition:|| |
/kwi:n/ (After the logician Willard V. 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.
In most interpreted languages, any constant, e.g. 42, is a quine because it "evaluates to itself". In certain lisp dialects (e.g. emacs lisp), the symbols "nil" and "t" are "self-quoting", i.e. they are both a symbol and also the value of that symbol. In some dialects, the function-forming function symbol, "lambda" is self-quoting so that, when applied to some arguments, it returns itself applied to those arguments. Here is a quine in lisp using this idea:
((lambda (x) (list x x)) (lambda (x) (list x x)))
Compare this to the lambda expression:
(\ x . x x) (\ x . x x)
which reproduces itself after one step of beta reduction. This is simply the result of applying the combinator fix to the identity function. In fact any quine can be considered as a fixed point of the language's evaluation mechanism.
We can write this in lisp:
((lambda (x) (funcall x x)) (lambda (x) (funcall x x)))
where "funcall" applies its first argument to the rest of its arguments, but evaluation of this expression will never terminate so it cannot be called a quine.
Here is a more complex version of the above Lisp quine, which will work in Scheme and other Lisps where "lambda" is not self-quoting:
(list x (list (quote quote) x)))
(list x (list (quote quote) x)))))
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:
For excruciatingly exact quinishness, remove the interior line break. Some infamous obfuscated c contest entries have been quines that reproduced in exotic ways.
ken thompson's back door involved an interesting variant of a quine - a compiler which reproduced part of itself when compiling (a version of) itself.