Settings

Theme

How to write a quine

czterycztery.pl

25 points by mci 3 days ago · 5 comments

Reader

thomascountz 13 hours ago

I learned something and along the way, I really enjoyed the author's writing style!

   Phew, it works. But it wasn’t easy, was it? That’s why remember my advice: when writing a quine, avoid using quotes. Once you start escaping them, you’ll never get out to go sledding. At this point, I stop writing the text and go sledding.
firasd 18 hours ago

The idea in all the examples in this page seems to be: write a string with some code and then write some more code that processes the string in a way that when the string is finally output it contains the variable assignment (of the string), the variable contents, and the later program code.

Indeed that is what the first wikipedia example does

a = 'a = {}{}{}; print(a.format(chr(39), a, chr(39)))'; print(a.format(chr(39), a, chr(39)))

I dunno, my explanation seems to make more sense in my head than the analogy this article fixates on of a machine that can build a machine etc

  • argee 2 hours ago

    How foolish, explaining succinctly. I don’t see a Substack writing career in your future.

erikschoster 17 hours ago

My bandmate made our site a quine at one point: https://web.archive.org/web/20161129032158/http://nasa.pink/

Today I suppose this would get clobbered by bots but in 2016 it was fun and I still am in awe of how simple he made it.

sixothree 11 hours ago

I put the python source code I used to generate a video inside the video itself. Not really a quine but it was fun to do.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection