# Golf an Anagram Quine

In this question I asked you to guess an anagram quine based on its output. However it looks like we don't have a question asking to golf an anagram quine yet. So your task will be to make the shortest anagram quine that you can.

### What is an anagram quine?

An anagram quine is a non empty program that prints an anagram of its source code, other than its original source.

Here's an example of an anagram quine in Python 2:

print'print*2'*2


• @LeakyNun No, It can't be a quine. Commented Jun 7, 2017 at 17:21
• Does the outputted code have to be a valid program? Commented Jun 7, 2017 at 17:43
• @MDXF No it does not. Commented Jun 7, 2017 at 18:38
• @Okx It should follow our standard requirements for a quine (other than it being a quine). Commented Jun 7, 2017 at 18:39
• @LeakyNun Mind you, I don't think 0-byte programs have anagrams that differ from the original either!
– Neil
Commented Jun 7, 2017 at 19:52

# Keg, 8 bytes

.,::,.


Try it online!

A rearrangement of the usual quine.

# 05AB1E, 13 bytes

"34çJ∞"34çJ∞



Outputs:

34çJ∞""∞Jç43



Try it online!

"34çJ∞"      # Push this string                 | [ 34çJ∞ ]
34ç   # Push a quote (")                 | [ 34çJ∞, " ]
J  # Join                             | [ 34çJ∞" ]
∞ # Mirror                           | [ 34çJ∞""∞Jç43 ]
# Implicitly output with a newline


# C, 60 bytes

main(s){printf(s="main(s){s=printf(%c%s%1$c,34,s);}",34,s);}  Just the shortest C quine with trivial modifications. Output: main(s){s=printf("main(s){s=printf(%c%s%1$c,34,s);}",34,s);}


Try it online!

# shortC, 34 bytes

Bs){Rs="Bs){s=R%c%s%1$c,34,s",34,s  Output: Bs){s=R"Bs){s=R%c%s%1$c,34,s",34,s


Try it online!

# str, 10 bytes

2xr;2xr;


Try it online! Outputs 2xr;2xr;

2xr;2xr;
.........;   preamble
2xr;       a string containing those character
2x     repeat twice
r    print the representation of that doubled string
;   end preamble (no program)


# Jelly, 7 bytes

“ØvṚ”Ṙv


Try it online!

# Braingolf, 36 32 bytes

"V#!1+!@@R!&@&@;"V#!1+!@@R!&@&@;


Try it online!

Outputs ""V#!1+!@@R!&@&@;V#!1+!@@R!&@&@;, which is the source, but with both " at the start, the ; is required at the end to prevent a trailing newline

## Explanation:

"V#!1+!@@R!&@&@;"V#!1+!@@R!&@&@;
"V#!1+!@@R!&@&@;"                 Pushes the charcode of each char in the string
V                Create stack2 and switch to it
#!              Push charcode of !
1+            Increment to charcode of "
!@@         Print twice, popping the 2nd time
!&@&@   Print entire stack twice, popping the 2nd time
;  Suppress implicit output to prevent trailing newline


Alternatively (not sure this one actually meets the requirement of it being a proper quine):

## Braingolf, 2 bytes


1


\n1, outputs 1\n

## Explanation:

\n1
\n   No-op, does nothing
1  Pushes 1
Implicit output of last item on stack plus trailing newline


# Java 8, 88 bytes

v->{String s="-v>{String s=%c%s%1$c;return s.format(s,34,s);}";return s.format(s,34,s);}  Outputs with both v and - swapped as anagram: -v>{String s="-v>{String s=%c%s%1$c;return s.format(s,34,s);}";return s.format(s,34,s);}


Explanation:

Try it online.

• The String s contains the unformatted source code (with - and v swapped to make it an anagram.
• %s is used to input this String into itself with the s.format(...).
• %c, %1\$c and the 34 are used to format the double-quotes.
• s.format(s,34,s) puts it all together.

# Microscript II, 8 bytes

"phq"pqh


# Microscript, 11 bytes (also a reverse quine):

0"Caxq"Caxq


# Jelly, 6 bytes

00,”ṘṘ


Try it online!

Output is

0,”Ṙ0Ṙ


# GolfScript, 8 bytes

{}*{.*}.


Output is {.*}{.*}

Works because the first three characters are garbage to find a way to get another set of braces in the program that don't show up.

If you don't care about whitespace, then {+}{.}+. outputs {+ .}{+ .}, which was my first attempt.

Try it online!

# Excel, 38 bytes

=REPT("=REPT(CHAR(34),2)&"&CHAR(34),2)


Output is:

=REPT(CHAR(34),2)&"=REPT(CHAR(34),2)&"


If you sort and concatenate the characters from either, you get this:

""&&(((()))),,==223344AACCEEHHPPRRRRTT