TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

My Adventure Writing My First Quine in Java

18 pointsby circuitbreakerover 14 years ago

5 comments

mncaudillover 14 years ago
Here's a PHP-&#62;C-&#62;Python-&#62;JavaScript-&#62;original PHP quine I wrote a few weeks ago: <a href="https://gist.github.com/749686" rel="nofollow">https://gist.github.com/749686</a><p>And here's a little write-up on how I approached the problem: <a href="https://nolancaudill.com/2011/01/01/how-to-build-a-quine/" rel="nofollow">https://nolancaudill.com/2011/01/01/how-to-build-a-quine/</a>
daniel-cussenover 14 years ago
In Lisp they're pretty easy:<p>((lambda (x) (list x (list 'quote x))) '(lambda (x) (list x (list 'quote x))))<p>returns itself (note: written in Clisp; I've had issues with Lispworks doing things properly). You can also stuff messages in there pretty easily:<p>((lambda (x y) (list x (list 'quote x) y)) '(lambda (x y) (list x (list 'quote x) y)) "Hello, world")
istjohnover 14 years ago
Python (triple quotes make this too easy):<p><pre><code> def q(s): print(s+'q(""' '"'+s+'"' '"")') q("""def q(s): print(s+'q(""' '"'+s+'"' '"")') """)</code></pre>
s3grahamover 14 years ago
A friend wrote a neat C one a while back: <a href="http://dwcope.freeshell.org/projects/spinningquine/" rel="nofollow">http://dwcope.freeshell.org/projects/spinningquine/</a>
snprbob86over 14 years ago
I consider this totally cheating:<p><pre><code> $ python quine.py import sys print open(sys.argv[0]).read(),</code></pre>
评论 #2145787 未加载
评论 #2145889 未加载
评论 #2145871 未加载