10
\$\begingroup\$

You should code a piece of code that looks like it outputs the language name but actually outputs the name reversed.

E.g. a Python program should look like it outputs Python but should actually output nohtyP.

The winner is the answer with the most upvotes in a week!

\$\endgroup\$

closed as off-topic by xnor, Sriotchilism O'Zaic, Julian Lachniet, Horváth Dávid, DJMcMayhem Jun 12 '17 at 19:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions without an objective primary winning criterion are off-topic, as they make it impossible to indisputably decide which entry should win." – xnor, Sriotchilism O'Zaic, Julian Lachniet, Horváth Dávid, DJMcMayhem
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    \$\begingroup\$ Flagged to close as underhanded questions are no longer welcome. \$\endgroup\$ – scatter Jun 12 '17 at 14:31
  • 7
    \$\begingroup\$ I'm voting to close this question as off-topic because underhand questions are no longer welcome in this site \$\endgroup\$ – caird coinheringaahing Jun 12 '17 at 14:35
  • 13
    \$\begingroup\$ It is such a pity that underhanded was made off-topic. The community loves them. \$\endgroup\$ – Adám Jun 12 '17 at 14:52
  • 1
    \$\begingroup\$ Could've been interesting if it had said "The characters in the language-name cannot be hard-coded". \$\endgroup\$ – officialaimm Jun 12 '17 at 16:10
  • 3
    \$\begingroup\$ @Adám: Looking at the quality of the answers to this challenge, I can see why we don't like challenges like this on the site any more. Most of the answers are terrible (not even obfuscated at all), and most of the rest are exploiting a loophole in the wording of the question. \$\endgroup\$ – user62131 Jun 12 '17 at 22:01

13 Answers 13

70
\$\begingroup\$

PHP, 3 bytes

PHP

Try it online!

It looks like it outputs the language name, but it's actually the letters in reversed order.

\$\endgroup\$
  • 10
    \$\begingroup\$ I normally hate underhand questions but this one is brilliant \$\endgroup\$ – caird coinheringaahing Jun 12 '17 at 14:34
  • 9
    \$\begingroup\$ Wait, it's reversed? How sure are you... \$\endgroup\$ – Cows quack Jun 12 '17 at 14:40
  • 10
    \$\begingroup\$ The challenge PHP was created for. \$\endgroup\$ – PyRulez Jun 12 '17 at 19:24
  • 2
    \$\begingroup\$ Cannot believe this... I hate Palindromes! \$\endgroup\$ – Mr. Xcoder Jun 12 '17 at 19:37
  • 9
    \$\begingroup\$ @KritixiLithos 100%. I pasted the output into a script where I compared it to 'PHP'[::-1] and it returned true. \$\endgroup\$ – Stewie Griffin Jun 12 '17 at 19:46
22
\$\begingroup\$

R, 8 bytes

Took me a while to figure this one out, but I think I've solved it!

cat("R")
\$\endgroup\$
19
\$\begingroup\$

Cubix

Because Cubix doesn't always need to be indecipherable

begin;
print "Cubix" > output;
end@?;

Try it online!

Watch it running

\$\endgroup\$
  • 3
    \$\begingroup\$ This is great!! \$\endgroup\$ – Giuseppe Jun 12 '17 at 19:00
16
\$\begingroup\$

HTML, 11 Bytes

‮HTML

-4 Bytes hardcoding the unicode character in a html file

HTML, 12 Bytes

‮HTML

The browser do the rest in a html file

‮HTML

\$\endgroup\$
  • 1
    \$\begingroup\$ Might want to check the underhanded tag \$\endgroup\$ – Skidsdev Jun 12 '17 at 14:45
  • \$\begingroup\$ @Mayube now better? \$\endgroup\$ – Jörg Hülsermann Jun 12 '17 at 14:59
  • 2
    \$\begingroup\$ Yeah that's much better \$\endgroup\$ – Skidsdev Jun 12 '17 at 15:01
12
\$\begingroup\$

Braingolf, 20 bytes

"Braingolf"@@@@@@@@@

Try it online!

@ Prints a character as ASCII, however because "Braingolf" pushes the string in order, the last item on the stack is f, so the first @ prints f, and so on.

Because of this quirk, the first Hello, World! program in Braingolf was actually:

"!dlroW ,olleH"@@@@@@@@@@@@@

Sidenote: Braingolf backwards is Flogniarb, which might actually be a better language name than Braingolf!

\$\endgroup\$
11
\$\begingroup\$

><>, 8 bytes

"><>">o<

Try it online!

Fun fact, this actually reverses the name of the language. The name, however, is a palindrome. Which is extra funny to me, because 'paling' (which almost spells the start of 'palindrome') is a kind of eel in Dutch.

\$\endgroup\$
  • 2
    \$\begingroup\$ @Mayube instinctively I thought that too and was "Huh, ><> outputs the stack reversed, why am I getting ><>". Then I counted the GT's and LT's... \$\endgroup\$ – steenbergh Jun 12 '17 at 14:53
  • 3
    \$\begingroup\$ but this doesn't work, because it outputs ><> not <><, the goal is to output the language name reversed \$\endgroup\$ – Skidsdev Jun 12 '17 at 14:58
  • 5
    \$\begingroup\$ @Mayube ><> reversed is still ><> ;) \$\endgroup\$ – Cows quack Jun 12 '17 at 15:00
  • 5
    \$\begingroup\$ Oh right yeah I see it now, I had to literally replace ><> with 121 in the code to understand what you were saying :P \$\endgroup\$ – Skidsdev Jun 12 '17 at 15:02
  • 1
    \$\begingroup\$ @steenbergh I countered it. ;) \$\endgroup\$ – Arjun Jun 15 '17 at 8:21
11
\$\begingroup\$

C++

#include <iostream>
int main()
{
    char C = 1;
    std::string CPP;
    for(C++; C++ < 42; C++)
        CPP += "C++";
    std::cout << CPP[C++];
    std::cout << CPP[C++];
    std::cout << CPP[C++];
    return 0;
}

Try it online!

\$\endgroup\$
8
\$\begingroup\$

Jelly, 8 bytes

“Jelly”U

Try it online!

"U" is a meaningless enough atom for "reverse an array" that 99% of programmers will likely assume that this program will output "Jelly". Maybe not so much code-golfers, though.

\$\endgroup\$
  • \$\begingroup\$ This is fairly obvious for even beginner Jelly programs like myself a few weeks ago. (I didn't downvote though). \$\endgroup\$ – HyperNeutrino Jun 13 '17 at 13:15
  • 1
    \$\begingroup\$ @HyperNeutrino Wow, I didn't realize you were a beginner Jelly program! :P \$\endgroup\$ – Esolanging Fruit Jul 17 '17 at 22:12
  • 1
    \$\begingroup\$ @Challenger5 Well I'm sorry that I can't engrish :p \$\endgroup\$ – HyperNeutrino Jul 17 '17 at 22:26
8
\$\begingroup\$

C (gcc), 20 18 bytes

-2 bytes thanks to cleblanc.

Specification says nothing about any output on STDERR so...

main(){puts("C");}

Try it online!

\$\endgroup\$
  • 3
    \$\begingroup\$ Why not use puts("C") to save a couple of bytes. \$\endgroup\$ – cleblanc Jun 12 '17 at 18:56
  • 1
    \$\begingroup\$ First time using C lol. Thanks! \$\endgroup\$ – totallyhuman Jun 12 '17 at 19:43
  • \$\begingroup\$ @Downvoter, please explain. \$\endgroup\$ – totallyhuman Jun 12 '17 at 23:27
5
\$\begingroup\$

APL (Dyalog), 24 bytes

Outputs on STDERR. This is a simple identity reduction, but APL goes right-to-left!

{⍺⊣⍞←⍵}/' APL'

Try it online!


Alternate, tacit, self-documenting version:

Print←⍞∘←
Identity←⊣
All←/
Identity∘Print All' APL'

Try it online!


A.P.L.: An Interactive Approach (pun intended). Let's ask for the three letters and input them in proper order:

⎕⎕⎕
'A'
'P'
'L'

Works because APL evaluates from right to left and thus asks for the rightmost letter first, but we enter the "A" first, etc.

Try it online!

\$\endgroup\$
4
\$\begingroup\$

J, 3 bytes

Jumping on the language-is-palindrome bandwagon:

'J'
\$\endgroup\$
  • \$\begingroup\$ Hm… |.'J' would be more fitting. \$\endgroup\$ – Adám Jun 12 '17 at 19:30
2
\$\begingroup\$

q, 5 bytes

a one letter language name makes this problem trivial

1"q";

Output:

q
\$\endgroup\$
-1
\$\begingroup\$

Bash, 10 bytes

rev<<<Bash

Try it online!

\$\endgroup\$
  • 4
    \$\begingroup\$ If you use sh instead of bash you can save two bytes. Never have I ever suggested switching languages for a program to save two bytes lol \$\endgroup\$ – Sirens Jun 12 '17 at 19:36
  • \$\begingroup\$ @Sirens: sh doesn't support the <<< redirection. bash is sometimes renamed to sh, but that doesn't change the fact that the language is still Bash. \$\endgroup\$ – user62131 Jun 12 '17 at 21:59
  • \$\begingroup\$ I stand corrected: sh --version: GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16). Kind of nasty that they do that given that sh and bash behave differently. \$\endgroup\$ – Sirens Jun 12 '17 at 22:41