r/dailyprogrammer • u/rya11111 3 1 • Mar 28 '12
[3/28/2012] Challenge #32 [difficult]
A quine is a computer program which takes no input and produces a copy of its own source code as its only output which, in turn, compiles and print out itself
10
Upvotes
4
u/Cosmologicon 2 3 Mar 28 '12
Also, an empty file works in python and probably most scripting languages. It actually works in C if you use the right makefile. Someone won the 1994 IOCCC with an empty quine.
1
u/Cosmologicon 2 3 Mar 28 '12
python. I have no idea what I'm doing....
3
u/stevelosh Mar 28 '12
Clojure:
2
u/jjduhamer 0 0 Mar 29 '12 edited Mar 29 '12
from a footnote in hackers delight, with minor mods to get it to compile with gcc
1
u/ladaghini Mar 28 '12
Shamelessly stolen from here, but it took some work to get it working in python:
1
u/mischanix Mar 28 '12
Looked fun, so some dirty C++:
1
u/eruonna Mar 28 '12
Standard lisp example:
1
u/omnilynx Mar 28 '12
In Javascript, with a loose definition of "compile":
Could be compressed more, but this is nice and clear.
1
u/gsg_ Mar 29 '12
Here's a very ugly one in C:
1
u/spc476 Mar 29 '12
Lua:
1
u/gjwebber 0 0 Mar 28 '12
Python:
0
u/[deleted] Mar 28 '12
[deleted] — view deleted comment