Talk:Quine

From Esolang
Jump to navigation Jump to search

Often a program that just performs access to its own source code file via I/O and prints it out isn't preferred or count as pure quine.

How about programs that access its own source code directly from memory? Should they count as a "pure" quine?--Rune 16:18, 12 Jun 2005 (GMT)

Fundamentally the same, I think. I clarified the article. --Graue 18:09, 12 Jun 2005 (GMT)

Organization

Wouldn't it be helpful to have a "category" called quines that would house these languages. I haven't had a chance to look but are all of the languages listed in the external resource described in this wiki? --Stux 05:11, 19 Oct 2005 (GMT)

Which languages? A quine is a program, not a language. And, no, all the languages listed on the Quine Page are not described in this Wiki. This wiki is only concerned with esoteric languages. --Rune 13:20, 19 Oct 2005 (GMT)
Ah! Good point. I reread it and realized I read it wrong the first time. I then assumed all quines (thinking they were a type of language) were all esoteric by definition. Anyway, Thank you! --Stux 18:29, 19 Oct 2005 (GMT)

Reincarnators

A variation on the idea of a quine would be a program (taking no input) that outputs an executable version of itself and then passes control to that version, which outputs an executable version of itself and passes control to that version, ..., ad infinitum. (My Subleq OISC webpage has such a "reincarnator" program.) Is this concept sufficiently different to warrant having a wiki page of its own?--r.e.s. (Talk) 21:15, 29 December 2007 (UTC)

This is much like one Underload program [1] I wrote some months ago, except with the difference that my program produces no output (so, does it mean reincarnators have infinite output?). I called the program type 'assembly', as it kind of assembles itself. In Underload such thing is easy to do, and interesting because it isn't possible in many languages. Here:
(a(:^)*^):^
While I'm on writing mood, I could just as well explain what it does. It first pushes string "a(:^)*^" to stack, then doubles (':') the stack entry, then inserts the top-most stack value into program ('^'), leaving identical copy to the stack -- the actual program to be ran now is "a(:^)*^", and first it adds brackets ('a') around the piece of data in the stack, making it "(a(:^)*^)", then it pushes ":^" in to stack, attachs ('*') that to the end of the lower entry in stack, making the stack have only one entry again, "(a(:^)*^):^", which is identical to the actual program, and then encountering the last instruction left, '^', which pops the stack entry into program, and the cycle starts again.
Anyways, it might be good to have a separate article for these, as they're quite different to quines, in my opinion. --Keymaker 12:41, 30 December 2007 (UTC)
Neat! Your program is a "purer" form of the reincarnator idea, because each reincarnation is a literal copy of the original, appended to the original in memory (although only the "tail" of the program ever executes) — so your program-length (original+1st+2nd+...) grows without bound, just as my Subleq output-length grows without bound. (I think this is mostly just a matter of how i/o is defined.) I don't think the "pure" form of reincarnator is possible in existing Subleq OISC models, because they use absolute addressing exclusively, which prevents the functionality equivalent to the Underload '^' command; consequently, I'll shortly add to my webpage a description of a relative addressing Subleq OISC, and will post there a "pure" version of my Subleq reincarnator program.--r.e.s. (Talk) 16:31, 30 December 2007 (UTC) Here's a Subleq Reincarnator that uses relative addressing.--r.e.s. (Talk) 02:30, 31 December 2007 (UTC)
Cheers, although I'm not sure if I understand what you mean with "your program-length (original+1st+2nd+...) grows without bound", as it doesn't in this one. :) The '^' instructions takes the top-most stack entry (removing it form the stack) and inserts that to the beginning of the program, so the stack will always be empty in the end of every cycle. In case I understood correctly what you were saying, that is...
I was going by what's written in the Underload article: the command '^' "... includes the top element of the stack into the program ... immediately after the ^ command ..." — so your program becomes program+program, which becomes program+program+program, etc., each time executing the latest one just appended: (a(:^)*^):^ (a(:^)*^):^ (a(:^)*^):^ ...". Or have I misunderstood?--r.e.s. (Talk) 21:09, 30 December 2007 (UTC)Edited to fix typo. --r.e.s. (Talk) 23:41, 30 December 2007 (UTC) Aargh ... that should have been "():^a()*^ ():^a()*^ (a(:^)*^):^ ...". However, it appears that as implemented in the Underload online interpreter, the instruction symbols ():^a()*^ just "disappear" from the program when they execute — although I couldn't find that behavior described in the Underload spec.--r.e.s. (Talk) 07:07, 4 January 2008 (UTC)
Ah, thus my confusion about what you wrote earlier. I hadn't even noticed that it wasn't mentioned in the specs, I've always took it for granted because the interpreter works that way. However, I believe it really is meant to be that way, so that each instruction disappears after it's executed. --Keymaker 13:41, 4 January 2008 (UTC)
The instructions become irrelevant after they're executed, so they may as well disappear. (There are no loops in Underload apart from Muriel-style loops.) I haven't paid any attention to the philosophical question about whether the program characters are still there after they've executed in Underload. --ais523 20:31, 4 January 2008 (UTC)
By the way, this OISC is self-modifying, right? So it creates the program forward in the memory and then runs it, printing every time the new part's code? (I haven't ran any, that's why these questions.) So, what about language's that don't allow this kind of thing? Say, brainfuck. In it the only way would be for the program to interpret itself, but that's, in my opinion, quite much different thing already. I call such program quinterpreter, but I've never made one yet. I actually mentioned this quinterpreter idea here: [2], but never got around writing the actual page as I couldn't decide exactly how it should work, afterall. --Keymaker 20:00, 30 December 2007 (UTC)
Yes, the Subleq program is self-modifying, and the new program gets appended to it (similar to how yours seems to work, but without the luxury of using a stack, etc.) — which, in my model, is how output is done. This is what I meant by dependency on the model's i/o definitions. My aim is to keep the model primitive, so everything is done in the same "address space", with no fancy memory-mapped i/o, etc. By my definition, "reincarnators" are possible only if a program can pass control to a new object it has created — so I suppose they're not possible in brainfuck. --r.e.s. (Talk) 21:09, 30 December 2007 (UTC)

Totally random discussion after 16 years of inactivity of the talk page about all Turing complete languages are quines

If there exists a loop of operations which contains the text of the source code, that means any Turing complete language is also possible to make a quine? ---Yetyetty1234567890 17 July 2023, 9:57 (UTC)

Quine by Wenyan

吾有一術。名之曰「自己複製」。欲行是術。是術曰。吾有一術。名之曰「置換」。欲行是術。必先得三數。曰「文字列」。曰「置換対象」。曰「置換先」是術曰。吾有一言。曰「「」」。名之曰「返品」。吾有一數。曰二。名之曰「未来」。吾有一爻。曰陽。名之曰「実行条件」。凡「文字列」中之「文字」。若「実行条件」者。若「文字」等於「「星」」中無陰乎「文字列」之「未来」等於「置換対象」者。昔之「文字」者。今「置換先」是。昔之「実行条件」者。今陰是。也。加「返品」以「文字」。昔之「返品」者。今其是矣。若非。昔之「実行条件」者。今陽是。也。加「未来」以一。昔之「未来」者。今其是矣。云云。乃得「返品」。是謂「置換」之術也。吾有一言。曰String.fromCharCode名之曰「函数」。施「函数」於一萬二千三百。昔之「始」者。今其是矣。施「函数」於一萬二千三百零一。昔之「終」者。今其是矣。吾有二言。曰「「吾有一術。名之曰星甲自己複製星乙。欲行是術。是術曰。吾有一術。名之曰星甲置換星乙。欲行是術。必先得三數。曰星甲文字列星乙。曰星甲置換対象星乙。曰星甲置換先星乙是術曰。吾有一言。曰星甲星甲星乙星乙。名之曰星甲返品星乙。吾有一數。曰二。名之曰星甲未来星乙。吾有一爻。曰陽。名之曰星甲実行条件星乙。凡星甲文字列星乙中之星甲文字星乙。若星甲実行条件星乙者。若星甲文字星乙等於星甲星甲星星乙星乙中無陰乎星甲文字列星乙之星甲未来星乙等於星甲置換対象星乙者。昔之星甲文字星乙者。今星甲置換先星乙是。昔之星甲実行条件星乙者。今陰是。也。加星甲返品星乙以星甲文字星乙。昔之星甲返品星乙者。今其是矣。若非。昔之星甲実行条件星乙者。今陽是。也。加星甲未来星乙以一。昔之星甲未来星乙者。今其是矣。云云。乃得星甲返品星乙。是謂星甲置換星乙之術也。吾有一言。曰String.fromCharCode名之曰星甲函数星乙。施星甲函数星乙於一萬二千三百。昔之星甲始星乙者。今其是矣。施星甲函数星乙於一萬二千三百零一。昔之星甲終星乙者。今其是矣。吾有二言。曰星甲星甲星丙星乙星乙。曰星甲星甲星乙星乙。名之曰星甲原文星乙曰星甲結果星乙。施星甲置換星乙於星甲原文星乙。於星甲星甲甲星乙星乙。於星甲始星乙。昔之星甲結果星乙者。今其是矣。施星甲置換星乙於星甲結果星乙。於星甲星甲乙星乙星乙。於星甲終星乙。昔之星甲結果星乙者。今其是矣。施星甲置換星乙於星甲結果星乙。於星甲星甲丙星乙星乙。於星甲原文星乙。昔之星甲結果星乙者。今其是矣。吾有一言。曰星甲結果星乙。書之。是謂星甲自己複製星乙之術也。施星甲自己複製星乙。」」。曰「「」」。名之曰「原文」曰「結果」。施「置換」於「原文」。於「「甲」」。於「始」。昔之「結果」者。今其是矣。施「置換」於「結果」。於「「乙」」。於「終」。昔之「結果」者。今其是矣。施「置換」於「結果」。於「「丙」」。於「原文」。昔之「結果」者。今其是矣。吾有一言。曰「結果」。書之。是謂「自己複製」之術也。施「自己複製」。

is this cheating???

what if you do this pseudo code:

print(file_name)

where the file name is:

print(file_name)

--(this comment by Xff at 05:44, 28 September 2024‎ UTC; please sign your comments with ~~~~)

If you do that, the file name is conceptually part of the program (because it wouldn't work if the filename were changed). So the quine is actually only printing half the program, not the whole thing, and isn't really fulfilling the definition. --ais523 22:34, 28 September 2024 (UTC)