top | item 2145423 My Adventure Writing My First Quine in Java 18 points| circuitbreaker | 15 years ago |blogs.adobe.com 8 comments order hn newest mncaudill|15 years ago Here's a PHP->C->Python->JavaScript->original PHP quine I wrote a few weeks ago: https://gist.github.com/749686And here's a little write-up on how I approached the problem: https://nolancaudill.com/2011/01/01/how-to-build-a-quine/ daniel-cussen|15 years ago In Lisp they're pretty easy:((lambda (x) (list x (list 'quote x))) '(lambda (x) (list x (list 'quote x))))returns itself (note: written in Clisp; I've had issues with Lispworks doing things properly). You can also stuff messages in there pretty easily:((lambda (x y) (list x (list 'quote x) y)) '(lambda (x y) (list x (list 'quote x) y)) "Hello, world") istjohn|15 years ago Python (triple quotes make this too easy): def q(s): print(s+'q(""' '"'+s+'"' '"")') q("""def q(s): print(s+'q(""' '"'+s+'"' '"")') """) s3graham|15 years ago A friend wrote a neat C one a while back: http://dwcope.freeshell.org/projects/spinningquine/ snprbob86|15 years ago I consider this totally cheating: $ python quine.py import sys print open(sys.argv[0]).read(), wh-uws|15 years ago I couldn't do python for a long time because it made me feel guilty all the time.Sometimes writing python literally feels like taking candy from a baby GrooveStomp|15 years ago This misses the point of a Quine. You haven't written the code to generate the string, you've used an external library that someone else wrote to do that job for you.I made this mistake the first time I tried too. load replies (1) unknown|15 years ago [deleted]
mncaudill|15 years ago Here's a PHP->C->Python->JavaScript->original PHP quine I wrote a few weeks ago: https://gist.github.com/749686And here's a little write-up on how I approached the problem: https://nolancaudill.com/2011/01/01/how-to-build-a-quine/
daniel-cussen|15 years ago In Lisp they're pretty easy:((lambda (x) (list x (list 'quote x))) '(lambda (x) (list x (list 'quote x))))returns itself (note: written in Clisp; I've had issues with Lispworks doing things properly). You can also stuff messages in there pretty easily:((lambda (x y) (list x (list 'quote x) y)) '(lambda (x y) (list x (list 'quote x) y)) "Hello, world")
istjohn|15 years ago Python (triple quotes make this too easy): def q(s): print(s+'q(""' '"'+s+'"' '"")') q("""def q(s): print(s+'q(""' '"'+s+'"' '"")') """)
s3graham|15 years ago A friend wrote a neat C one a while back: http://dwcope.freeshell.org/projects/spinningquine/
snprbob86|15 years ago I consider this totally cheating: $ python quine.py import sys print open(sys.argv[0]).read(), wh-uws|15 years ago I couldn't do python for a long time because it made me feel guilty all the time.Sometimes writing python literally feels like taking candy from a baby GrooveStomp|15 years ago This misses the point of a Quine. You haven't written the code to generate the string, you've used an external library that someone else wrote to do that job for you.I made this mistake the first time I tried too. load replies (1) unknown|15 years ago [deleted]
wh-uws|15 years ago I couldn't do python for a long time because it made me feel guilty all the time.Sometimes writing python literally feels like taking candy from a baby
GrooveStomp|15 years ago This misses the point of a Quine. You haven't written the code to generate the string, you've used an external library that someone else wrote to do that job for you.I made this mistake the first time I tried too. load replies (1)
mncaudill|15 years ago
And here's a little write-up on how I approached the problem: https://nolancaudill.com/2011/01/01/how-to-build-a-quine/
daniel-cussen|15 years ago
((lambda (x) (list x (list 'quote x))) '(lambda (x) (list x (list 'quote x))))
returns itself (note: written in Clisp; I've had issues with Lispworks doing things properly). You can also stuff messages in there pretty easily:
((lambda (x y) (list x (list 'quote x) y)) '(lambda (x y) (list x (list 'quote x) y)) "Hello, world")
istjohn|15 years ago
s3graham|15 years ago
snprbob86|15 years ago
wh-uws|15 years ago
Sometimes writing python literally feels like taking candy from a baby
GrooveStomp|15 years ago
I made this mistake the first time I tried too.
unknown|15 years ago
[deleted]