News for hackers. Stuff that matters.
Re:My Adventure Writing My First Quine in Java by mncaudill on Thursday January 27, 2011 @01:05AM (#2146797)
Here's a PHP->C->Python->JavaScript->original PHP quine I wrote a few weeks ago: https://gist.github.com/749686

And here's a little write-up on how I approached the problem: https://nolancaudill.com/2011/01/01/how-to-build-a-quine/

Re:My Adventure Writing My First Quine in Java by daniel-cussen on Wednesday January 26, 2011 @09:08PM (#2146265)
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")

Re:My Adventure Writing My First Quine in Java by istjohn on Sunday February 06, 2011 @01:38AM (#2185150)
Python (triple quotes make this too easy):

  def q(s):
      print(s+'q(""' '"'+s+'"' '"")')
  q("""def q(s):
      print(s+'q(""' '"'+s+'"' '"")')
  """)
Re:My Adventure Writing My First Quine in Java by s3graham on Wednesday January 26, 2011 @07:40PM (#2145999)
A friend wrote a neat C one a while back: http://dwcope.freeshell.org/projects/spinningquine/
Re:My Adventure Writing My First Quine in Java by snprbob86 on Wednesday January 26, 2011 @06:28PM (#2145761)
I consider this totally cheating:

  $ python quine.py
  import sys
  print open(sys.argv[0]).read(),
Re:My Adventure Writing My First Quine in Java by wh-uws on Wednesday January 26, 2011 @06:33PM (#2145787)
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

Re:My Adventure Writing My First Quine in Java by GrooveStomp on Wednesday January 26, 2011 @06:58PM (#2145889)
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.

Re:My Adventure Writing My First Quine in Java by snprbob86 on Thursday January 27, 2011 @06:12AM (#2147399)
Oh I know, hence I called it "cheating"