I just learnt about quines — self-replicating programs.
Write a program that outputs its own source code.
You are not allowed to read any external files with the source code.
Empty programs producing no output or constant expressions are not allowed.
These seem a playful way to get to grips with:
- quoting constructs
- string escaping
- source code representations / self-referencing
I imagine the tests would have to get creative, since we’d not have the usual input-output checks but rather just checking if the (non-empty, non-constant) input matches the output exactly.
Has this idea been floated before ? Does it sound like a fun addition ? ![]()