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))()
# adapted from a Quine by Sean B. Palmer
print (lambda s='print (lambda s=%r: (s %% s))()': (s % s))()
python x='x=%r;print(x%%x)';print(x%x)
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))
(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")) }
#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")) }
fsharp (fun s -> printf "%s %s" s s) "(fun s -> printf \"%s %s\" s s)"
(fun s -> printf "%s %s" s s) "(fun s -> printf \"%s %s\" s s)"
Submit a new solution for
python,
erlang,
clojure,
cpp ...
There are 20 other solutions in
additional languages (
fantom,
groovy,
haskell,
java ...)