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)