Obligatory Quine Challenge
Rules
Using your language of choice, golf a quine.
A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output.
No cheating -- that means that you can't just read the source file and print it. Also, in many languages, an empty file is also a quine: that isn't considered a legit quine either.
Additionally, your quine may not consist of only one data section. This includes HTML programs without tags (thus only printing their source), and the Golfscript program 1
.
Scoring
The shortest program in bytes wins. Trailing newlines must be counted if your program outputs one.
2 answers
Husk, 8 bytes
S+s"S+s"
Basically Leo's original quine.
It concatenates the string evaluated version of S+s
to itself.
So: "S+s" + "\"S+s\""
gives the original code.
5 comments
Might wanna change the name to something better, just sayin' — Razetime 2 months ago
"that means that you can't just read the source file and print it" Does JavaScript "toString()" count as reading the source file? — Moshi 2 months ago
I posted a PHP simplistic answer that was rejected based on a reference to SE rules. Can we get those rules (a) at a minimum linked inside this question (the only link is to a Wikipedia definition, which since Wikipedia can change beyond our control is not definitive) and (b) preferably spell out all the rules somewhere on Codidact (Meta to start, eventually a Help/FAQ page). And if that info. is already on Codidact, include a link here. — manassehkatz 2 months ago
I've asked a meta question regarding whether or not we should import the FAQ questions from SE, which includes a comprehensive definition of a valid quine. — Lyxal 2 months ago
I was also thinking of reposting the quine question, but you beat me to it. One thing that I was thinking of changing was to allow function submissions, which would let some answers be somewhat distinct from the old question. — Jo King 2 months ago