Quines
An honest man scores a single point on a silly test.
Given the importance of always trying to improve one's score on the Hacker Test, various challenges must from time to time be undertaken.
One such challenge is to write a quine, or a self-reproducing program. As per Wikipedia, "a quine is a computer program that takes no input and produces a copy of its own source code as its only output." (My emphasis.)
The "takes no input" part is crucial for a quine to be a quine: It won't do to, say, use an interpreted language and just read and print the very file that's being executed.
This means that in some languages, it's debatable what constitutes an actual quine. In REXX, for example, the following code will reproduce itself:
/* Quine? */ say sourceline(1)
The REXX interpreter stores the source code of the script in a linked list (or similar structure) - hence, no input is required by the script itself. Alas, this is a bit like having sex at the 1986 FIFA World Cup's England-Argentina quarter final - fucking close to cheating - and it's imperative that any point scored on the Hacker Test is unambiguous and fair.
Hence, here are two quines. One is in JavaScript, using a few language idiosyncracies to keep it short. The other is in Python, using a somewhat more traditional approach. They are perhaps not the best quines, but they are mine.
To avoid spoiling anyone's fun, use the link below to toggle the visibility of the source code.
More spoilers are available at Rosetta Code.

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.