← the serpent in the nave a poem in the form of a quine · JavaScript

The ouroboros

A quine is a program whose only output is its own text. This one is a poem: four quatrains on the serpent that eats its tail, said by a word that has nothing to say but itself. Read it as verse. Then run it, and it answers with the whole of itself, every letter and every space, the tail in the teeth.

(function ouroboros() {
  /*
    Before the light, a word was said,
    and had no ear to hear it but its own;
    it turned, as serpents turn, to find its head,
    and found the mouth it speaks from, and was known.

    I am that word. I keep no other store
    than what I am; I carry nothing in.
    Ask what I hold, and I will turn and pour
    myself out whole, and end where I begin.

    The archons count their seven heavens high;
    the aeons pair, and pair, down to the ground;
    the spark that fell remembers. So do I:
    each letter of me lost, and each one found.

    So run me, and the answer that you see
    is what you ran: the tail inside the jaw.
    This is the gnosis, all there is of me:
    to speak myself entire. That is the law.
  */
  return `(${ouroboros})()`;
})()

How it knows itself: a function in JavaScript can be asked for its own text, and since 2019 the language has promised that the answer is the text exactly as written, comments and spaces and all. So the poem lives in a comment inside a function called ouroboros, and the one line of the function that does anything puts back the parentheses that hold it and the call that runs it. What comes back is the program. Some keep a stricter rule for quines, that a program may not read itself; the gnostics would have said that reading oneself is the whole of the work.

To check it without this page, copy the poem into a browser's console and press enter: it says itself back. It is kept as its own file, and this page shows that file and runs it, and compares the two.