Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!ginosko!usc!apple!sun-barr!decwrl!adobe!greid From: greid@adobe.com (Glenn Reid) Newsgroups: comp.windows.news Subject: Re: A PostScript Quine (a followup) Keywords: Quine, useless trivia Message-ID: <1194@adobe.UUCP> Date: 14 Sep 89 20:23:43 GMT References: <17620@bellcore.bellcore.com> Sender: news@adobe.COM Reply-To: greid@adobe.COM (Glenn Reid) Organization: Adobe Systems Incorporated, Mountain View Lines: 27 In article <17620@bellcore.bellcore.com> sjs@bellcore.com (Stan Switzer) writes: > 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"). > > 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} Wait--now I get it. The execution of the procedure has to give you the same procedure back. I was lost in the definition of "quine". According to the way you've set it up (using "n { exec } repeat"), the following should qualify: {/exec{dup}def} I guess this doesn't qualify, since it only works if you invoke it with "exec", and (only after the first invocation :-), but it sure is short... Glenn Reid