danso 13 years ago

I know we shouldn't care about the source, crazy-insane as he obviously is, but FWIW, the author is Yusuke Endoh, one of the Ruby core members. RubySource had an interview with him here:

http://rubysource.com/meet-fifteen-ruby-core-committers/

He lists his "hobby in programming" as: "writing a Quine and enjoying esoteric programming."

scrumper 13 years ago

I feel awful for pointing this out, but the author spelled Copyright incorrectly in the last line.

Fortunately, he can correct it without blowing out his Ascii art by deleting the extra space between '##' and 'Quine'.

I'd issue a pull request myself, but it'd be like me putting soy sauce on a piece of Jiro Ono's sushi. I am completely unworthy.

  • cbhl 13 years ago

    Wouldn't you also need to fix src/QR.rb.gen.rb?

    • scrumper 13 years ago

      Yeah. Like I said, not worthy :)

      I've started looking through it. It's very clever, most of it beyond my ken, but even the technique with the image template of '#'s is a treat when you start to see how it works.

  • ilyanep 13 years ago

    I feel like the fact that you took the time to figure out how to fix it makes you at least somewhat worthy.

  • sans-serif 13 years ago

    When I first spotted that, I wasn't sure if it was intentional. Maybe the comments are a part of the input.

  • quchen 13 years ago

    But then the cycle would probably not close anymore - the end result would not be the initial code.

epidemian 13 years ago

Fascinating. Even the README generator is on another level of meta: https://github.com/mame/quine-relay/blob/master/src/README.m...

  • polemic 13 years ago

    And: https://github.com/mame/quine-relay/blob/master/QR.rb

    This project isn't code, it's art.

    Edit:

    Heh, Brainfuck, Whitespace, Logo... and notice they're all in alphabetical order?

    • quchen 13 years ago

      Brainfuck is fairly practical compared to Unlambda and INTERCAL.

      • jlgreco 13 years ago

        I have to admit that I was a little let down to see that APL was not included. Not in the same class as those languages... technically.

        • Jach 13 years ago

          Or J to keep things ascii. Though I would have loved to have seen Malbolge. (http://en.wikipedia.org/wiki/Malbolge) It's already super impressive, but with some extra work it could be hyper impressive!

      • mbillie1 13 years ago

        Perhaps my favorite paragraph on all of wikipedia:

        INTERCAL has many other features designed to make it even more aesthetically unpleasing to the programmer: it uses statements such as "READ OUT", "IGNORE", "FORGET", and modifiers such as "PLEASE". This last keyword provides two reasons for the program's rejection by the compiler: if "PLEASE" does not appear often enough, the program is considered insufficiently polite, and the error message says this; if too often, the program could be rejected as excessively polite. Although this feature existed in the original INTERCAL compiler, it was undocumented.

        • xyzzy123 13 years ago

          COME FROM also allows elegant aspect-oriented programming :)

          • _pmf_ 13 years ago

            > COME FROM also allows elegant aspect-oriented programming :)

            I used to make fun of Intercal, until I had to do with a Simulink model that made use of FROM blocks.

            It's just as retarded as you'd expect. It's as if someone intentionally decided to take a step back from structured programming, and then some more steps back.

          • im3w1l 13 years ago

            Sounds like a listener to me.

            • xyzzy123 13 years ago

              Not quite, a listener isn't supposed to steal your thread of control indefinitely...

    • epidemian 13 years ago

      And there are interpreter implementations for both Whitespace and Unlambda.

      There's even a Rake task to generate a Makefile that runs all the 50 multiquines and uses the dependency tracking of make to determine the order of execution instead of running the 50 commands one after the other in the same rule.

      It's like everything in this project is incredibly elegant and self-referential.

Rabidgremlin 13 years ago

If anyone wants to give this a go. I have created a Vagrant config which installs the OS, tools and runs the chain of programs. You can find it here: https://github.com/rabidgremlin/vagrant-quine-relay

  • candeira 13 years ago

    I installed it yesterday. It fails at the point of Jasmin:

    jasmin QR.j QR.j:2: Warning - Syntax error.

    ^ QR.j:2: Error - Couldn't repair and continue parse.

    ^ QR.j: Found 2 errors

    And then completely craps out at the badly generated Java. Any idea of what goes?

jcromartie 13 years ago

The code that generates the quine is included. There's still lots of super impressive stuff here, but don't be intimidated thinking he wrote that monster by hand!

https://github.com/mame/quine-relay/blob/master/src/code-gen...

  • lisper 13 years ago

    LOL! The codegen for Java is so much longer than any of the others!

  • stavros 13 years ago

    Anyone care to explain how it works? I can see how the first step "Ruby -> X" is done, but what about "X -> Y"?

  • Leszek 13 years ago

    If anything, that makes it even more impressive.

jetru 13 years ago

My thoughts went from "This is amazing" to "But he must have taken a lot of time and brainpower to do this" to "This is useless really" to "So what? If I wanted to do that I would take a year perhaps if I ever could" to "This is amazing"

  • boomlinde 13 years ago

    As if in line with some sort of sick and twisted version of the Kübler-Ross model

RyanZAG 13 years ago

That is both the most incredible thing I've ever seen, yet also by far the saddest thing I've ever seen. Props to the author for taking dedication to a whole new level.

Link to a description of what this actually is: https://github.com/mame/quine-relay

  • GuiA 13 years ago

    I'm sorry, how is that sad?

    • eksith 13 years ago

      Indeed. That's a transmutation circle of awesome.

      • Sealy 13 years ago

        I think he's referring to the relative uselessness of the code. Yes it would have taken a lot of time, talent and intellect to produce but from what I understand is of relatively little use?

        Can someone correct me if I'm wrong?

        • eksith 13 years ago

          There has been a spat of comments criticizing stories along the lines of "what use does it have?" As pointed out previously on all of them, and at the risk of sounding redundant, this is "Hacker News", not "Only Useful Things News" or even "Mildly Interesting News".

          Looking at the front page of HN, I think it's pretty safe to say it's moved a fair distance from news of only VCs, startups and such to the realm of what we find interesting. This is interesting. It's not useful, particularly well built or even presentable at a sales meeting. But it is interesting.

        • brey 13 years ago

          you've just described art.

          • bennyg 13 years ago

            Came to say this, but I could not say it with the brevity you did.

            What function is the Mona Lisa accomplishing behind layers of glass, with security guards posted 'round the clock, in a museum in France?

        • saraid216 13 years ago

          That's the entire point of a quine.

      • arianvanp 13 years ago

        This dude's State Alchemist title is probably Fullcode Alchemist

    • hnriot 13 years ago

      possibly that someone clearly very smart wasted his/her intellect doing this, rather than advancing the species by curing obesity, heart disease and cancer?

      • scott_s 13 years ago

        Which is a silly notion. Everyone needs entertainment and to have fun. Some people do it in different ways than others.

      • Noxchi 13 years ago

        The first two are already curable (with food).

      • raldi 13 years ago

        Do you feel the same way when someone bakes a cake, takes a walk, watches a sporting event, knits a sweater, or writes a poem?

        • ionforce 13 years ago

          I think that people view art as a side effect of abundance. It is something that naturally arises given a surplus of some thing.

          The point of contention here is that someone of that level of intellect has "wasted" their talent on art, rather than productivity, which "should" come first.

          For varying definitions of "should" and "wasted", of course.

        • gambler 13 years ago

          The effort involved in doing this is incomparable with the things you just mentioned. This is nothing like baking a cake, more like spending thousands of dollars to build a life-sized Eiffel Tower out of matchsticks.

          • raldi 13 years ago

            You have no idea how long it took to write this program. I bet it's less than the amount of time a typical baseball fan spends watching games over the course of a season.

            P.S. Knitting a sweater takes forever too. Especially if it has buttons.

            • StavrosK 13 years ago

              Man, fuck buttons.

              • newsit 13 years ago

                Comment of the year :)

          • bennyg 13 years ago

            Who cares about whether a person should build an Eiffel Tower out of matchsticks or go try to solve cancer? Pushing humanity forward is great - and so is finding personal happiness and growth through exploration. Don't knock one or the other; in fact, don't knock any at all. Both are ways to ascribe meaning to this meaningless place.

            • jlgreco 13 years ago

              The sort of attitude he is demonstrating is backed by some sort of perverse notion that "smart" people somehow owe so much more to society than the rest of humanity that they should not have hobbies because that would delay them paying back their debt.

              I don't know what could cause somebody to adopt such a twisted notion, but I think the roots of it go deeper than I care to know.

      • breadbox 13 years ago

        I also know plenty of people who waste their intellect painting canvases, when they could be advancing the species by doing something practical. Shall we shed a tear for their wasted efforts as well? But of course not. Art is its own justification.

        And this program, my friends? This is art.

        • gambler 13 years ago

          Art that only exists for the sake of existing, without intent to express, explore, or otherwise stimulate human mind - art of that sort is garbage. There are plenty of people who vehemently defend that garbage, but it doesn't make it any less wasteful use of human time and attention. Personally, I will never respect it simply because there was a lot of effort involved.

          • epidemian 13 years ago

            > without intent to express, explore, or otherwise stimulate human mind

            I hope you're just being sarcastic.

          • breadbox 13 years ago

            "I will never respect it simply because there was a lot of effort involved."

            Nor will I, or much of anyone else, I imagine. I respect it because it stimulates my mind. My imagination is moved by it in much the same way that it's moved by holding an acorn in my hand while contemplating a fully grown oak tree. Or studying the math that causes z <- z^2 + C to describe a ridiculously intricate shape. Or implementing my own minimal Lisp interpreter from scratch. Or trying to understand the Banach-Tarski paradox. These things stimulate my sense of wonder because they're like a magic trick, but there's no trickery involved. And when I contemplate them, I learn more about the world. Art cannot aspire to much more than that.

            • gambler 13 years ago

              Nor will I, or much of anyone else, I imagine.

              Yet people gladly upvote stories about computers implemented insite Minecraft and life-size spaceships made out of Lego blocks. Are you saying it has nothing to do with the difficulty involved? I doubt this story would be equally well received if there was some easy way to achieve the same result. If you take difficulty of the task out of the equation, what will be left? How much of what's left is genuine creativity and skill, and how much is mere patience?

              • breadbox 13 years ago

                "Are you saying it has nothing to do with the difficulty involved?"

                No, of course not. The "simply" was what I was disagreeing with.

          • snsr 13 years ago

            That's a pretty caustic take on an inherently subjective matter: the appreciation of beauty.

            Also, in what way is this exercise not exploratory?

            • romaniv 13 years ago

              What does it explore?

              • jlgreco 13 years ago

                The very nature of self-expression.

                (If you are looking for other people to explain to you how to appreciate art, you are going to have a bad time.)

          • Falling3 13 years ago

            I'm am tired of these elitist views of art. You sir, know nothing of art.

          • eksith 13 years ago

            http://www.lynetteabel.org/L-ABEL-Seminar-Appreciate.htm

               Eli Siegel explains in his great essay "The Serious Aspect of Snobbery":  
                Snobbery is the unwillingness to like something, unless at the same time it 
                makes one feel more important;...
                [It] is the inability or lack of desire to appreciate justly.
            • gambler 13 years ago

              You using a quote of a quote to launch a personal attack, while explicitly doing the thing that you're accusing me of. That is, you assume that the motivation behind my comment is to feel superior to certain other people by excluding some things from the realm of "good art". Yet your comment explicitly divides people into "snobs" and "not snobs", makes a fairly obvious statement about superiority of one group and hints at the fact that you belong to the other group.

              • eksith 13 years ago
                  >...art of that sort is garbage. There are plenty of people 
                  who vehemently defend that garbage, but it doesn't make 
                  it any less wasteful use of human time and attention.
                

                ...is your opinion. Opinion that as downvoters have noted, is full of snobbery. Not even mildly vindicated snobbery that's tolerated on this forum like picking your religion (I.E. favorite IDE, programming language etc...) which someone could assert with reasonable confidence with anecdotes of personal experience at least; it was wholly devoid of intellectual merit... and was snobbery.

                That's not a personal attack. I don't know you personally and nor was it an attack. I felt it was merely an observation. But If you took an observation as an attack, then doesn't that speak to the validity of the quote?

                I don't appreciate a whole swath of what is considered "modern art" either (though I do like Dada, if anything for it's quirkiness that I find interesting). But never have I called someone else's creation of time and effort "garbage" purely due to my lack of appreciation.

                • gambler 13 years ago

                  it was wholly devoid of intellectual merit...

                  I think the notion that purpose and intent behind art is far more important than the amount of effort involved in its creation has considerable amount of intellectual merit. Even more so considering how unpopular it is. Whether people choose to read the whole comment, or prefer to see "bla, bla, bla, garbage!" is a different matter.

                  • eksith 13 years ago
                      >Whether people choose to read the whole comment, or prefer to see "bla, bla, bla, garbage!" is a different matter.
                    

                    Interesting that you assume we didn't read the rest of the comment. I assure you most of us do prefer to take things in context. It's OK to look up once instead of looking down all the time.

                    Purpose is ancillary to art. Art without purpose and merely is as art has been a cornerstone of creative expression since art has existed. The fact that you prefer to inject purpose behind it now has no bearing whatsoever on what people will consider artistic. You're not the arbiter of worth or taste.

          • msutherl 13 years ago

            Unlike the others, I completely agree. Art that does not "express, explore, or otherwise stimulate the human mind"[1] is the definition of boring.

            I would however claim that the vast majority of art does stimulate the mind, though it may not stimulate yours without some additional effort. Indeed just about anything in the world is capable of stimulating your mind if you look closely enough at it, to paraphrase John Cage.

            [1] ... or, if we take a 'vibrant matter' / 'object oriented ontology' view of the world, stimulate something.

            • Tobu 13 years ago

              John Cage? You were quoting Gustave Flaubert:

              > Pour qu’une chose soit intéressante, il suffit de la regarder longtemps.

              http://flaubert.univ-rouen.fr/correspondance/conard/outils/1...

              • msutherl 13 years ago

                No, I wasn't quoting anybody, I was paraphrasing John Cage. Here is the quote:

                “If something is boring after two minutes, try it for four. If still boring, then eight. Then sixteen. Then thirty-two. Eventually one discovers that it is not boring at all.” ― John Cage

          • voyou 13 years ago

            On the contrary, to the extent something intends to "express, explore, or otherwise stimulate human mind," it isn't art - it's rhetoric, or science, or entertainment. Obviously lots of works of art were created for some end (renaissance paintings functioned as religious and political propaganda; Shakespeare's plays are entertaining), but they are art to the extent that they step back from that end, and display what Kant calls "purposiveness without particular purpose."

        • SilasX 13 years ago

          Still, I reserve the right to be a lot more impressed with this than a painting of a bunch of cans of Campbell's soup.

      • lifeformed 13 years ago

        Smart people are too burdened with the responsibility to save the world to spend on leisure.

        • nazgulnarsil 13 years ago

          We don't owe you shit, it was like this when we got here.

      • scythe 13 years ago

        This criticism could also be applied to, say, the entirety of pure mathematics.

        What is sad is that the author probably has no plan to explain how it was accomplished, which prevents anyone from learning from this.

        • omoikane 13 years ago

          The author has explained it, here: http://d.hatena.ne.jp/ku-ma-me/20130715/p1

          In the "spoiler" section:

          """ Normally quines are made like this:

             s = (something that generates your own source code)
          
             puts s
          

          At the same time, a Ruby program that outputs a Perl program looks like this:

             puts "print(\"...\");"
          

          If you combine these with quine methods, you get a multi-quine that goes between Ruby and Perl:

             s = (something that generates your own source code)
          
             puts "print(\"#{ s }\");"
          

          Theoretically you just repeat this process. Except, there are the following practical problems:

             - Need proper escaping
          
                + Lots of old languages do not support C style of escape sequences.
          
                + Depending on languages, you need to escape interpolations.
          
             - Cobol and Fortran programs have troublesome constraints
          
                + Need 7 spaces on the left and less than 80 columns per line, etc.
          
             - Naive escaping will cause intermediate files to get too large.
          
                + JVM Strings have 64K size limit.
          
                + Languages like Intercal and Whitespace will become unbearably slow.
          

          In order to avoid these, Perl requires something like ppencode, Java needs LZW compression to avoid string size limits. Cobol's line length limit was satisfied using Closure generator, Fortran's line length limit was satisfied using Coffeescript generator. People who are interested should see the generated code. """

          In general, there isn't any standard method to making quines. You just keep on tweaking the code until the input and output matches, mostly by trial and error.

      • wicknicks 13 years ago

        I don't think people want to spend all their time trying to fight cancer or heart disease. Once in a while, you really need to get your mind to work on entirely useless things. IMO, that sort of mental workout makes people tackle the real hard problems better.

      • wpietri 13 years ago

        If I make a ranked list of all the ways that people spend their time, I cannot imagine a sensible scoring algorithm that puts making a quine relay lower in value than posting an internet comment bitching about somebody making a quine relay.

        • jbranchaud 13 years ago

          +1, imagining the scoring algorithm you mention would even rank higher than the posting of that comment!

        • shawn-furyan 13 years ago

          Very funny. I think it might be possible to come up with a sensible algorithm that yields such a result. If so, it would definitely have $time_spent in a denominator somewhere :)

          [edited to improve wording]

        • aerolite 13 years ago

          bitching about someone making a quine relay takes like 10 seconds, though.

          • saraid216 13 years ago

            That's because there's only ten seconds' worth of intelligence going into the bitching.

            A truly worthwhile bitching would take at least an hour.

      • andyhmltn 13 years ago

        So are you saying that if he had not spent his time doing this, he would have cured cancer? You're forgetting the amount of people this will inspire to go on and create amazing software.

      • Seeless 13 years ago

        This wasn't made by a doctor or a biochemist.

      • chernevik 13 years ago

        So the guy who did this must spend his time solving the problems people cause for themselves by eating too much, exercising too little? And smoking?

        I don't think so.

  • dustingetz 13 years ago

    Its not sad at all. Really good programmers can do things that ordinary programmers think impossible. This code was probably generated. Here is a paper on quine generation[1], and the authors have a very popular talk where they livecode a quine generator; that is, they livecode a program that generates an infinite list of quines[2] (source code from talk [3]).

    [1] http://users-cs.au.dk/danvy/sfp12/papers/byrd-holk-friedman-... [2] http://www.infoq.com/presentations/miniKanren [3] https://github.com/webyrd/quines

    The talk is amazing and hilarious.

    On point, if the code is not generated in this fashion, there is assuredly a "work smart not hard" trick that drastically simplifies the problem.

    • sampo 13 years ago

      > This code was probably generated.

      The code generator is included in the repo: src/code-gen.rb

  • kragen 13 years ago

    Saying that hacking is "sad" is arrogantly elevating your own limited worldview over the worldview of hackers. Perhaps someday you could hope to become as awesome as the person you're criticizing, but first you have to realize that being a hacker is something worth aspiring to.

  • skrebbel 13 years ago

    If you think that anything about this is sad, then you simple don't love programming enough.

    There's nothing wrong with not loving programming, but calling people who clearly do "sad" because of it, is a bit, well, sad.

  • Keale2 13 years ago

    I feel like everybody is taking this comment the wrong way. It sounds like a compliment followed by a joke.

    This is a relatively common form of humor. A great achievement followed by a realization of the cost of that achievement.

    "I just won my 1000th game of <insert video game>! ...I should go outside."

quchen 13 years ago

In case someone is able to run this beast, I'd appreciate an upload of the intermediate source files.

avivo 13 years ago

This should be in MOMA.

tome 13 years ago

Why's there a Star of David in the middle?

  • quchen 13 years ago

    a) The author is Jewish

    b) It's semantically relevant

    (Probably the latter. Same goes for the typo in the copyright notice in the end.)

    • msvan 13 years ago

      Both semantically and semitically relevant, in other words.

    • tome 13 years ago

      I did consider a) but I'm pretty sure "Yusuke Endoh" is not Jewish.

    • michaelmwu 13 years ago

      He's Japanese, and one of the authors of the Ruby programming language

      • saraid216 13 years ago

        Being Japanese doesn't actually preclude you from being Jewish. It makes it highly unlikely... but not impossible.

        • michaelmwu 13 years ago

          True.. but you're more likely to find a Japanese Mormon than a Japanese Jew.

  • anateus 13 years ago

    It's actually a transmutation circle symbol from the manga/anime Fullmetal Alchemist

  • felideon 13 years ago

    Why do people always ask this? Last time it was in the Visual Website Optimizer thread.

    • zerr 13 years ago

      Why people shouldn't ask? Especially when it is not obvious how something is relevant.

  • dragontamer 13 years ago

    The symbol of note is not "The Star of David", but instead Ouroboros, the eternal snake... symbolized by a snake eating his own tail.

    I believe he chose the symbol Ouroboros to represent the "immortality through change" of the code. In one story... Ouroboros was an immortal snake who constantly shed his skin, and took on many forms.

    Similarly, this code constantly changes form, yet is immortal. While it changes form, it manages to keep its identity.

    The Star of David is incidental. As far as I know... it was added to the Ouroboros symbol in the anime/manga Full Metal Alchemist, but that rendition is perhaps the most famous artistic rendition of Ouroboros in recent culture.

    Ouroboros had some connotations in the classical psudo-science of Alchemy as well. So perhaps there is an earlier version of Ouroboros + Star of David.

    • recuter 13 years ago

      > The Star of David is incidental. As far as I know... it was added to the Ouroboros symbol in the anime/manga Full Metal Alchemist, but that rendition is perhaps the most famous artistic rendition of Ouroboros in recent culture.

      Wheel of Time series begs to differ.

      • dragontamer 13 years ago

        The Great Serpent Ring does seem to be Ouroboros indeed... but it does not have the Star of David on it. :-p

      • airencracken 13 years ago

        The author, Yusuke Endoh, is Japanese though, so it stands to reason that he might be more exposed to a Japanese representation.

    • toyg 13 years ago

      The "Star of David", like many Jewish symbols, has long been associated with alchemy and magic arts (and other less savoury enterprises) in classic European cultures. See for example [1] from a basic google search. This is likely why it was used in the anime, probably just to avoid the usual boring pentagram.

      [1] http://www.truthperfected.com/2012/12/seal-of-solomon.html

      • eli_gottlieb 13 years ago

        Which means it gets shown in anime for pure Rule of Cool reasons, and then Japanese people have not the slightest idea that it's actually the flag-symbol of Jews.

        It's not like I would know the standard symbol for Shintoism unless I googled it.

    • StavrosK 13 years ago

      I think it's much simpler than that: Ruby code goes through all those languages, just to generate itself again, hence completing the cycle.

  • vacri 13 years ago

    A fan of Chinese Checkers?

_pmf_ 13 years ago

Day 5462 on the internet.

Today, I have seen true madness.

codeulike 13 years ago

NB: I originally posted this with the link pointing to the QR.rb file, which is the main code file and also a piece of Ascii art. Looks like the mods switched the link back to the main project to provide more context. But to have people looking at QR.rb first and then reading about what it does afterwards was the idea. Amazing piece of work by @hirekoke.

https://github.com/mame/quine-relay/blob/master/QR.rb

zw123456 13 years ago

This reminds me very much of the various types of mathematical exercises that seem to be very esoteric and academic but turned out to be very useful in some solution in physics (eg. lorentz contractions). I would not be surprised if some insight indirectly comes from this insanely amazing exercise.

  • GhotiFish 13 years ago

    It terrifies me what this insight might be.

zabcik 13 years ago

The best part is that the cycle is in alphabetical order.

e3pi 13 years ago

Molecular biology?

If computer languages were evolving organisms, may this be a metaphor how genetic/chromosome encoding reshuffles itself, and this approximates some common minimalist packaging of the DNA among all these fifty(++?) programming languages? Can we consider this Quine Relay as a `prequel' ancestral "Hello Dad" gene, and also, how its wonderful aesthetic creativity, familiar layperson recognizable and understandable information and charming symbols at myriad representation levels, is enhancing its survival as a persistent executable(living?) `gene-meme'? Eg, is anyone else posting some of this on Facebook?

terabytest 13 years ago

Anyone care to explain how this actually works?

  • SilasX 13 years ago

    Per the explanation linked in the discussion [1], the initial file generates code in another language. That code, when executed, generates code in yet another language. The process continues until the output is the code of the original file.

    [1] https://github.com/mame/quine-relay

    • terabytest 13 years ago

      What is unclear to me is how the final program manages to represent the entire code (thus the entire language loop). Wouldn't doing that make the source code recursive and infinite? Or am I missing something important?

      • SilasX 13 years ago

        No more recursive or infinite than any other self-replicator that has intermediate "bodies".

        EDIT: To clarify, there's actually a wrapper script on top of it all that tells the first script to execute, storing its output in file 2, then execute file 2 with language 2, then execute file 3 with language 3, and so on.

      • baddox 13 years ago

        We already have lots of single-language quines, which are programs that output exactly their own source code when evaluated. In other words, there's a text C and a function F such that F(C) == C (i.e. C is a fixed point of F), where F is a single programming language evaluator and C is a source code file.

        In this case, however, the function F happens to be the composition of a bunch of individual functions. So F is equivalent to Rexx ∘ R ∘ Python ∘ Prolog, but with many more functions composed than I am willing to type right now. This doesn't change the nature of what we're searching for, which is simply a fixed point of a given function. Realistically, of course, it makes it more difficult and impressive for someone to actually accomplish, but mathematically/computationally speaking it's the same thing.

      • shawnz 13 years ago

        If you look at the ruby source file[1], you'll see that the first thing it does is take all of its source and put it in a variable $s. Then it evaluates the source code in that variable, with that source having access to itself as a string. All of the intermediate representations could easily contain this string in its entirety (and they likely do). Hopefully you can see now how it's not so impossible (but still ridiculously awesome!)

        [1] https://github.com/mame/quine-relay/blob/master/QR.rb

      • thedigitalengel 13 years ago

        Representing self is actually not that difficult or mind-bending; you just need a representation that is isomorphic to the program source. For instance, you could store the ASCII symbols in an integer array:

          int array = { ... } // holds the source code,
                              //  except its own representation
        
          int array_index; // The index in the source code
                           // (where the actual integers in
                           // array interpreted as source appear)
        
          for i = 0 to array_index:
            print (array[i] as an ASCII character)
        
          for i = 0 to array_length:
            print (array[i] as integer ++ ", ")
        
          for i = array_index + 1 to array_length:
            print (array[i] as an ASCII character)
        

        The core idea is that you can interpret `array` in two ways, as an array of integers or an array of ascii characters representing the program source. The only difficult part is adjusting array_index. With a little effort, this can be scaled to a chain of languages.

  • wiredfool 13 years ago

    I thought I understood recursion, but apparently I need to understand recursion first.

  • kragen 13 years ago

    Quines work the same way as cellular reproduction. I don't think there are any life forms that carry alternation of generations out to 50 different stages, though; the most I've heard of is two.

inaudible 13 years ago

Awe inspiring stuff! But as a Ruby illiterate, I am left wondering what it is about the Ruby language that draws in such a level of creative / abstract / esoteric genius to use it as a starting point. Is there something about Ruby in particular, or is just a case of an individual obsessing over a craft?

zerr 13 years ago

This is cool of course, but we are even more interested in knowing the mechanics and how it is done.

This is relevant to any similar cool thing what gets submitted on HN.

"what" is interesting, "how" is much more interesting.

e3pi 13 years ago

Remember those delightful self-referential Scott Kim creations in Godel Escher Bach? Here, made alive, and becomes most everything in the known coder's world. A super-chameleon quine mime.

martin_ 13 years ago

The arrangement of the languages is alphabetical, did this complicate things at all? Would it have been simpler in a different order (though less elegant)?

k-mcgrady 13 years ago

This is really cool. Considering installing Ubuntu to give it a try (don't think I could be bothered trying to get all those packages manually).

  • Axsuul 13 years ago

    Someone should create a vagrant box for this.

tomasien 13 years ago

This is amazing. Think the concept can be taken to another level in some way? Begin a universal translator of some small level?

arde 13 years ago

What, no Erlang? Sheesh! Amazing work.

joeblau 13 years ago

Holy crap. Codeception, now I can write in one language and run in every language :)

codereflection 13 years ago

If someone tries this, please post a video from start to finish. This is incredible.

EGreg 13 years ago

Well, someone clearly paid attention in Programming Languages class :)

mrwnmonm 13 years ago

why did you choose that order, is there a reason for it?

  • srin 13 years ago

    I think it's just alphabetical, so no particular path through the languages that he saw as easier/harder

    • ionforce 13 years ago

      I think the code has a generator framework, so the fact that they are alphabetical may just be convenient/arbitrary; the code could be generated to run in any order (I think).

karangoeluw 13 years ago

How does one debug code like this?

  • chii 13 years ago

    you dont. When you reach level zen, you write code that's already bug free :]

    • karangoeluw 13 years ago

      That 'level zen' sounds like a state that doesn't exist.

soheil 13 years ago

meta(N^K)

JimmaDaRustla 13 years ago

If you could go ahead and explain WHY...that'd be grreeeaaaat!

celwell 13 years ago

I now know what a quine is. And learned of about 15 new programming languages.