2
\$\begingroup\$

Very simple, write a program that at first glance appears to be a quine, but is not. Upon running, the program actually prints the source to a real quine, obviously distinct from the original program in some way, preferably creative, but since this is a popularity contest, the answer with the most upvotes wins.

Standard Loopholes which are no longer funny are forbidden.

\$\endgroup\$
  • \$\begingroup\$ Can I allow requiring specific input in my answer, or does my program have to work regardless of input? \$\endgroup\$ – ASCIIThenANSI May 13 '15 at 17:13
  • \$\begingroup\$ I think it has to work regardless of the input. \$\endgroup\$ – SuperJedi224 May 13 '15 at 21:05
  • \$\begingroup\$ Why does this question have so many dislikes? \$\endgroup\$ – Loovjo May 31 '15 at 12:15
  • \$\begingroup\$ @loovjo I have no idea. Vague? Open ended? \$\endgroup\$ – Christopher Wirt May 31 '15 at 23:13
  • 4
    \$\begingroup\$ I'm voting to close this question as off-topic because it's an [underhanded] challenge, which was on-topic a year ago, but is now off-topic by community consensus. \$\endgroup\$ – James Apr 23 '16 at 20:21
18
\$\begingroup\$

CJam

{"_~"}_~ 

Well, whether this looks like a real quine to you depends on whether you're used to CJam or GolfScript, but anyway, it looks like and prints the standard quine:

{"_~"}_~

Wait, isn't that the same thing?

Nope, there's a space at the end of the first code. I believe the same thing would work in almost any language with almost any quine.

Test it here.

| improve this answer | |
\$\endgroup\$
  • 3
    \$\begingroup\$ CJam. What can it do? Everything, apparently... \$\endgroup\$ – ASCIIThenANSI Apr 29 '15 at 16:44
12
\$\begingroup\$

H9+

"Hello, world!"

It's easy: In H9+, anything other than H, 9, or + is ignored, and therefore, this is a quine. Or is it?

Nope. H actually outputs Hello, world!, with no quotes.

| improve this answer | |
\$\endgroup\$
9
\$\begingroup\$

Python

s="s=%r\nprint(s%%s)"
print(s%s)

Explanation:

The output actually has single quotes instead of double quotes.

Try it here

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

Mathematica

This one can be quite tricky to newer users.

Function[Print[StringJoin[ToString[FullForm[#0]], "[];"]]][];

Explanation:

Some people might not notice the #0 as not being part of the FullForm. In the output, it is replaced with Slot[0]. Everything else is the same.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Haskell

Recursion can be tricky at times.

let s = "let s = " ++ show s ++ " in putStrLn s" in putStrLn s

This actually outputs the same as 's = "let s = " ++ show s in putStrLn s', namely 'let s = "let s = \"let s = \\\"let s = \\\\\\\"let s = \\\\\\\\\\\\\\\"let s = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"...'


Basically, Haskell is trying to let s be equal to itself, with let s = appended to it, and escaping the string.


Obviously, in order to escape " you need \", and in order to escape \ you get \\, which is how the long stream of backslashes is formed.

| improve this answer | |
\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.