Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!usc!rutgers!bellcore!spectral!sjs From: sjs@spectral.ctt.bellcore.com (Stan Switzer) Newsgroups: comp.windows.news Subject: A PostScript Quine Keywords: Quine, useless trivia Message-ID: <17620@bellcore.bellcore.com> Date: 14 Sep 89 14:26:42 GMT Sender: news@bellcore.bellcore.com Reply-To: sjs@bellcore.com (Stan Switzer) Organization: Bellcore Lines: 37 "'Yields falsehood when preceded by itself in quotes" yields falsehood when preceded by itself in quotes." -- W. V. O. Quine (paraphrase) A "quine" is a program which when evaluated yields its own representation. A quine can be formally described as a fixed point of a language's denotation function. Trivial evaluations (e.g.: literals) are excluded and the program cannot require any input data (e.g.: "cat cat.c"). In my experience, the merit of a language is inversely related to the length of its shortest quine. (Though I _am_ prejudiced toward reflective semantics.) For the heck of it, let's say a PostScript quine is a procedure "{...}" which when followed by "n { exec } repeat" yields the same (or equivalent) value for any non-negative integer value of "n" (including 0). The shortest I have found for PostScript is {{[ exch /dup load /exec load ] cvx} dup exec} Compare to Lisp: ((lambda(f)(list f (list 'quote f))) '(lambda(f)(list f (list 'quote f)))) or (ASCII) C: char*f="char*f=%c%s%c;main(){printf(f,042,f,042,012);}%c";main(){printf(f,042,f,042,012);} Not that it'll change your life or anything... Enjoy, Stan Switzer sjs@bellcore.com