View Category
produces a copy of its own source code
In computing, a quine is a computer program which produces a copy of its own source code as its only output.
python
# adapted from a Quine by Sean B. Palmer
print (lambda s='print (lambda s=%r: (s %% s))()': (s % s))()
print (lambda s='print (lambda s=%r: (s %% s))()': (s % s))()
x='x=%r;print(x%%x)';print(x%x)
clojure
(def s"(def s%s)(printf s(pr-str s))")(printf s(pr-str s))
cpp
#include <cstdio>
#define B(x) x; printf("{ B(" #x ") }\n");
int main()
{ B(printf("#include <cstdio>\n#define B(x) x; printf(\"{ B(\" #x \") }\\n\");\nint main()\n")) }
#define B(x) x; printf("{ B(" #x ") }\n");
int main()
{ B(printf("#include <cstdio>\n#define B(x) x; printf(\"{ B(\" #x \") }\\n\");\nint main()\n")) }
fsharp
(fun s -> printf "%s %s" s s) "(fun s -> printf \"%s %s\" s s)"
