3 ms·
My favorite quine is just "#!/usr/bin/cat". Not sure what programming language I would say that is written in though...
by jcalvinowens 5y ago
My favorite quine is just "#!/usr/bin/cat". Not sure what programming language I would say that is written in though...
- lifthrasiir 5y agoYou are writing in Text [1], where every program is a quine. [1] https://esolangs.org/wiki/Text https://esolangs.org/wiki/Text
- kazinator 5y agoThus hash-bang is an delivery mechanism, which allows Text programmers to produce stand-alone executables. Usually, Text programmers need to include a slight bit of complexity to conceal the hash bang line, in order to produce just the intended text, like #!/bin/sed 1d Hello, World! But if the complexity of sed 1d is replaced by the pure cat implementation of the Text language which omits nothing, then self-reproducing behavior is obtained in stand-alone delivery form.
- kazinator 5y agoThat is a polyglot which is written in two languages. It is written and interpreted using the cat language, which is an interpreted language in which every possible byte stands for a self-printing action, and those actions are carried out in order for all bytes of the input. It is also written in the hash-bang language, which is placed into a file to specify to the OS kernel what interpreter to use for the file. So first this is interpreted as a hash-bang language statement, which then causes the cat interpreter to be applied, causing it to be a cat language statement. The hash-bang interpretation is what induces the binding between the cat interpreter and the hash-bang statement, evoking the cat language interpretation. :)
- dcminter 5y agoI like it, although if one is going for pure code-golf, then an executable empty file is a quine too :) touch foo && chmod +x foo ./foo Unless one considers the commands to create & invoke it (as above) to be a part of the "source code" of course...