45
\$\begingroup\$

Challenge:

In the programming language of your choice, take no input and output your programming language's name.

Fair enough, right?

Restrictions:

  • You can't use any character that is included in your programming language's name in your code. E.g., if I use Batch, I must not use the chars 'B' 'a' t' 'c' 'h' in my code. Note that this is case sensitive. I can still use the char 'b' because it's different from 'B'.
  • You can have "junk output" before or after the name of the language
  • Version number doesn't count as part of the name of the language. E.g., I can use the number 3 in the code in my answer if it's in Python 3
  • The output of the programming language name is not case sensitive.
  • Brute-forcing all possible letter combinations and hoping you get your language name is forbidden.

Example outputs: (let's say my programming language is called Language) (✔ if valid, else ✖)

  • Language
  • Body language is a type of non-verbal communication in which physical behavior, as opposed to words, is used to express or convey information. Such behavior includes facial expressions, body posture, gestures, eye movement, touch and the use of space.
  • Language 2.0 - © 1078 AD some company
  • foobar

This is thus shortest code wins.

\$\endgroup\$
  • 7
    \$\begingroup\$ The rule about case sensitive restrictions is very ambiguous. Which is the correct orthography: BASIC Basic or basic? I'm pretty sure I can find examples for all three. \$\endgroup\$ – Level River St Jan 24 '17 at 23:47
  • 7
    \$\begingroup\$ Obligatory "Just having your code be blank but have a flag like --version isn't allowed"? \$\endgroup\$ – Value Ink Jan 25 '17 at 0:00
  • 88
    \$\begingroup\$ Have case-insensitive output while banning the language name case-sensitively allows boring solutions that just output the language name case-swapped. \$\endgroup\$ – xnor Jan 25 '17 at 0:47
  • 12
    \$\begingroup\$ You made a mistake by allowing users to output junk data. All they have to do is use a language where the compiler include the name whenever there's an error. It's cool but not the challenge I was hoping for \$\endgroup\$ – Lynob Jan 26 '17 at 8:23
  • 3
    \$\begingroup\$ This question really needs to be specified that "Code" must be run. Most languages will show their name in the usage dump if you don't give any code--for instance "Java" or "Groovy" at the command line with no code will display the correct name, however if you pass code (even "empty" code) as in (groovy -e "") you will get an empty response. Same for compile problems, the compiler usage or error output does not mean you wrote a program. \$\endgroup\$ – Bill K Jan 26 '17 at 18:30

129 Answers 129

1
\$\begingroup\$

Ada (GNAT), 164 bytes

function Test return Integer is
 function puts(C:out Integer)return Integer with Import,Convention=>C;Text:Integer:=16#00616441#;
begin return puts(Text); enD Test;

Try it online!

It is hard not being able to use EITHER a. Especially since the I/O library is called Ada.Text_IO and there's no way around that. Since I can't access Ada's standard library, I have to go around and import some I/O from C. Luckily its easy to do that from within Ada, unfortunately the function that would work well is putchar with that pesky a again.

To work around I need to somehow send a pointer through to C. Unfortunately the types that will do this are Interfaces.C.Pointers which has an a and access types, also with A. Thus I'm left using Ada's implicit interpretation of out parameters in C interfaces as being a pointer. Now I just construct a 32-bit integer as my 'string' and it just so happens to fit "Ada" and the null terminator.

I was close to removing the only d too, but there's no way out of using end. Depending on how you style Ada you can toggle its case, as the language is completely case insensitive (but with the standard spelling the case insensitivity still bans the a).

\$\endgroup\$
1
\$\begingroup\$

Stax, 2 bytes

V?

Run and debug it

Outputs version info.

\$\endgroup\$
1
\$\begingroup\$

x86, 8 bytes

Returns the string "x86" in eax.

0:  b8 3c 1c 1b 00          mov    $0x1b1c3c,%eax
5:  d1 e0                   shl    %eax
7:  c3                      retq  

As ASCII:

�<���

The idea is to get 0x363878. It may be possible to shorten this with a clever multiply or other instruction.

\$\endgroup\$
1
\$\begingroup\$

Ruby, Not 31 but 28 bytes

p'Qtax'.chars.map(&:next)*""

Thanks @iamnotmaynard for the improvements

Try it online!

\$\endgroup\$
  • \$\begingroup\$ I noted that it does, I'm just trying out the older version of ruby, to see if I can get a solution which doesn't. It's not going well. \$\endgroup\$ – AJFaraday Mar 27 '18 at 9:33
  • \$\begingroup\$ Maybe .chars instead of .bytes? p 'Qtax'.chars.map{|x|x.next}.join \$\endgroup\$ – manatwork Mar 27 '18 at 9:36
  • \$\begingroup\$ @manatwork I'm afraid not. String#chars returns an array of strings, each one of which is 1 character long. 'R' + 1 returns TypeError: no implicit conversion of Fixnum into String \$\endgroup\$ – AJFaraday Mar 27 '18 at 9:37
  • \$\begingroup\$ That is why I used .next. (Same as .succ, but that is forbidden because “u”.) Or shorter: p'Qtax'.chars.map(&:next)*'' \$\endgroup\$ – manatwork Mar 27 '18 at 9:39
  • \$\begingroup\$ @manatwork AAARRRGGGHHH! I forgot about succ. That's so much better! Thanks! :@) \$\endgroup\$ – AJFaraday Mar 27 '18 at 9:40
1
\$\begingroup\$

@, 4 bytes

Although the language name is 1 byte, outputting the name is astonishingly difficult.

-{}0

This subtracts the string a by 0, which is undefined behavior and thus throws an error:

Traceback (most recent call last):
  File "@", line 477, in <module>
    res  = root.eval()
  File "@", line 413, in eval
    return self.ins.func(*self.argv, *self.insargs)
  File "@", line 115, in insHYPHEN
    raise TypeError('-')
TypeError: -
\$\endgroup\$
1
\$\begingroup\$

Ruby, 3 bytes

p$:

Try it online!

From the documentation:

The array contains the list of places to look for Ruby scripts and binary modules by load or require. It initially consists of the arguments to any -I command line switches, followed by the default Ruby library, probabl "/usr/local/lib/ruby", followed by ".", to represent the current directory. (Mnemonic: colon is the separators for PATH environment variable.)

This is not guaranteed to work on any system, but works at least on TIO, and on most (if not all) Linux distributions when Ruby is installed.

\$\endgroup\$
  • \$\begingroup\$ I had this thought too, but I was wondering if it was too platform dependent. Granted any standard installation should work, but I could create a platform that wouldn't. \$\endgroup\$ – Alexis Andersen Jan 25 '17 at 20:25
1
\$\begingroup\$

VBA, 13 Bytes

I tried using error codes and all sorts of little tricks, but it would appear that this is about as compact as I can get it, as boring as it is.

Anonymous Immediates window function that takes no input out outputs to the immediates window. Works with both Win and Mac Excel, Access, Word, PowerPoint, Outlook and Publisher

?ucase("vba")
\$\endgroup\$
1
\$\begingroup\$

Oasis, 2 bytes

ne

Explanation

n  Push n
 e Recurse with a(n-n); i.e. a(0), which is undefined

This tries to do recursion of itself where a(0) is undefined. Therefore, it recurses until the Python interpreter's call stack overflows:

Fatal Python error: Cannot recover from stack overflow.

Current thread 0x00007f4457bba740 (most recent call first):
  File "/usr/lib64/python3.7/ast.py", line 67 in _convert
  File "/usr/lib64/python3.7/ast.py", line 91 in literal_eval
  File "/opt/oasis/oasis.py", line 27 in pop_stack
  File "/opt/oasis/oasis.py", line 261 in func_a
  File "/opt/oasis/oasis.py", line 268 in func_a
  ...
/srv/wrappers/oasis: line 3:  2892 Aborted                 (core dumped) python3 /opt/oasis/oasis.py .code.tio "$@" < .input.tio

Real time: 0.242 s
User time: 0.182 s
Sys. time: 0.036 s
CPU share: 90.02 %
Exit code: 134

TIO

\$\endgroup\$
1
\$\begingroup\$

C, 23 bytes (without Error)

This works on little-endian machine. 67 is 0x00000043 and the layout on memory is {0x43,0x00,0x00,0x00} (32bit, little-endian) . This memory block is a valid c string (zero-ending char array). Then, just pass the pointer of this memory block into puts.

main(i){i=67;puts(&i);}

As the restrictions:

  • putchar is not allowed (contains c). Then puts is used.
\$\endgroup\$
1
\$\begingroup\$

Linux, Unix Shell (sh/bash...) (6 bytes)

find /
\$\endgroup\$
0
\$\begingroup\$

JavaScript (ES6), 29 45 bytes

There's probably a better way.

let f =

_=>'\x4A\x61\x76\x61\x53\x63\x72\x69\x70\x74'

console.log(f())

\$\endgroup\$
  • \$\begingroup\$ @ETHproductions This turns out to be more complicated than I expected. Here is a fixed (but weak) version. \$\endgroup\$ – Arnauld Jan 25 '17 at 0:27
  • \$\begingroup\$ Huh, none of the hex values contain a letter, except for J. Perhaps that could be useful in some way (though I highly doubt it...) \$\endgroup\$ – ETHproductions Jan 25 '17 at 0:30
  • \$\begingroup\$ Abuse case-insensitive requirements for output to print jAVAsCRIPT? \$\endgroup\$ – Value Ink Jan 25 '17 at 0:48
  • \$\begingroup\$ @ValueInk I supposed I could do that but I actually wish this rule didn't exist. It kinda ruins the game. \$\endgroup\$ – Arnauld Jan 25 '17 at 1:03
  • 1
    \$\begingroup\$ How about just _=>'\x45\x53'+(5+1)? It is technically ECMAScript6 \$\endgroup\$ – Flambino Jan 25 '17 at 1:20
0
\$\begingroup\$

Pascal, 47 bytes

BEGIN WRITE(UpCASE('p'),LOWERCASE('ASCAL'))END.

Output:

$ ./g
Pascal$

Alternative boring way, 25 bytes:

BEGIN WRITE('pASCAL')END.

Output:

$ ./g
pASCAL$
\$\endgroup\$
  • \$\begingroup\$ You can't use P, A, S, C, A or L in your source code. \$\endgroup\$ – Clearer Feb 14 '17 at 1:49
0
\$\begingroup\$

Python, 0 bytes (cheating?)

$ python
Python 2.7.13 (default, Jan 13 2017, 10:15:16) 
[GCC 6.3.1 20161221 (Red Hat 6.3.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

python is a shell command not a language command. It could equally be xyzzy if I have previously done

$ ln -s $( which python) xyzzy

Or just x (one byte, if you insist on counting the shell command as well).

\$\endgroup\$
  • 1
    \$\begingroup\$ I think you have to mark this as "Python (REPL)", because we've decided that a REPL is a different language from the language itself. Apart from that, though, I don't see why it wouldn't work; "REPL" is not part of the language's name. \$\endgroup\$ – user62131 Jan 25 '17 at 13:51
  • \$\begingroup\$ You're not allowed to use the characters contained in the language's name. \$\endgroup\$ – mbomb007 Jan 25 '17 at 14:56
  • \$\begingroup\$ x or xyzzy don't use characters contained in the languages name. I thought a little explanation was in order. Maybe cheating though, in that the python interpreter prints its own name by default. \$\endgroup\$ – nigel222 Jan 25 '17 at 15:33
  • \$\begingroup\$ This is what I considered to submit, but decided for something else. IMHO this is valid, because invoking the programming language itself does not mean you are using the name as part of the code - (almost) any other answer needs to call the interpreter or compiler anyway if you want to actually run the program! \$\endgroup\$ – Radovan Garabík Jan 25 '17 at 16:01
0
\$\begingroup\$

Scala. 11 bytes

1##

Run with scala -feature /path/to/file.scala (+8 bytes for -feature).

Outputs:

/path/to/file.scala:1: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
1##
 ^
/path/to/file.scala:1: warning: postfix operator ## should be enabled
by making the implicit value scala.language.postfixOps visible.
This can be achieved by adding the import clause 'import scala.language.postfixOps'
or by setting the compiler option -language:postfixOps.
See the Scaladoc for value scala.language.postfixOps for a discussion
why the feature should be explicitly enabled.
1##
 ^
two warnings found
\$\endgroup\$
0
\$\begingroup\$

Del|m|t, 25 bytes

TIO

= : Abiyjyq / 2 > ? # * !

No command line arguments, so the starting delimiter is .

Explanation:
Format: (token) command effect

(=) 29        jump command - no-op the first time through, skips 1 command the other times
(:) 26        Pushes the following String backwards. Only happens once
(A...) 25     "Del|m|t" shifted down by 3. Also the "print char" command
(/) 15        Duplicates top value
(2) 18        Nots the top, used in order to check if we printed everything
(> ?) 30, 31  If we did, end the program
(# *) 3, 10   Add 3 to the value, setting each character back to the desired "Del|m|t"
(!) 1         Pushes 1, which makes the first command skip the pushing of the string.
              This then causes the string "Abiyjyq" to print the top value when we repeat.

The trick here is using the String Abiyjyq to both encode the string Del|m|t, and print the top of the stack as a character. Thankfully, no character in Del|m|t is also in Abiyjyq, because the is in the language name are replaced with |s

\$\endgroup\$
0
\$\begingroup\$

Brainelly, 36 bytes

ƑA$ƒṃƁẸḷ-ṚżƁẸH/ƑKƁƊṄ$Ƒ9$⁾ṃmṚỤ$Ƒ7EṢṘ{

Original Brainfuck code:

++++[++++>---<]>-.---[----->+<]>-.+++[->+++<]>++.++++++++.+++++.---------.+++++++..-[--->+<]>.

With a no-op inserted to avoid the character restriction:

++++[++++>---<]>-.---[----->+<]>-.+++[->++++-<]>++.++++++++.+++++.---------.+++++++..-[--->+<]>.

\$\endgroup\$
0
\$\begingroup\$

Stacked, 30 + 1 = 31 bytes

+1 for p extension. Call like:

node stacked.js -pe "(115:1+97:2+107:6-:1-)#:''join"

(where e is the execute flag.) The p prints the top of the stack at program end. The output is 'stacked'.

Explanation

(115:1+97:2+107:6-:1-)#:''join
(                    )           array containing these
 115                             [115, 
    :1+                                115+1,
       97                                     97,
         :2+                                      97+2,
            107                                         107,
               :6-                                           107-6,
                  :1-                                               107-6+1]
                      #:         cast each number to a character
                        ''join   join by empty strings

Example usage

λ node stacked.js -pe "(115:1+97:2+107:6-:1-)#:''join"
'stacked'
\$\endgroup\$
0
\$\begingroup\$

Ruby, 18 16 7 6 bytes

Feels like cheating to be able to use different cases, but OK sure

The language can be case-insensitive??? Wow

-1 byte from @manatwork

p:rUBY
\$\endgroup\$
  • \$\begingroup\$ As all kind of garbage is accepted around the name: p:rUBY. \$\endgroup\$ – manatwork Jan 25 '17 at 14:54
0
\$\begingroup\$

8th, 4 bytes

.ver

Output is as follows:

8th 16.14 WIN64 Free (6362ab32) custid: ########

I blanked my custid with ########

\$\endgroup\$
0
\$\begingroup\$

JavaScript, 19 bytes

Sadly, the shortest answer is also the least interesting:

_=>'jAVAsCRIPT'

Yes, the challenge allows for this. I also wish it didn't.

I first tried to do this using atob, but forgot that the name of that function contains forbidden letters. I also tried using open with a data URI using base64-encoding, only to realize once I had finished writing my answer that open also contains a forbidden character…

One valid solution that outputs JavaScript with the correct casing would be encoding the whole name as \x4A\x61\x76\x61\x53\x63\x72\x69\x70\x74, but that solution was already taken.

Edited multiple times because various solutions turned out to be invalid.

\$\endgroup\$
  • 5
    \$\begingroup\$ Your code is invalid, it contains t & a \$\endgroup\$ – TrojanByAccident Jan 25 '17 at 1:31
  • 3
    \$\begingroup\$ Isn't this still invalid as the code contains both A and t which are found in ECMAScript? \$\endgroup\$ – Emigna Jan 25 '17 at 14:03
  • 1
    \$\begingroup\$ and the c in EMCAScript \$\endgroup\$ – TrojanByAccident Jan 25 '17 at 20:33
  • 2
    \$\begingroup\$ @Emigna Apologies, I seem to keep overlooking those invalid characters. Case in point: I just wasted another 45 minutes on a solution that turned out to be invalid... So for now I'll just go for the boring-but-valid solution. \$\endgroup\$ – user2428118 Jan 26 '17 at 15:17
  • 1
    \$\begingroup\$ @TrojanByAccident The console.log fragment was not part of the solution, I just put it there so you could see the output using the Stack Snippet. Anyway, I updated my submission. After writing a new solution that turned out to be also invalid, with the valid (but boring) solution above. \$\endgroup\$ – user2428118 Jan 26 '17 at 15:18
0
\$\begingroup\$

JavaScript (REPL), 42 bytes

'\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74'
\$\endgroup\$
0
\$\begingroup\$

Pyth 8 bytes

r"pYTH"2

Try it online

\$\endgroup\$
0
\$\begingroup\$

JAVA, 21 byte

throw new Exception();

print

Exception in thread "main" java.lang.Exception

Full program :

public class OutputProgrammingLanguageName {

  public static void main(String[] args)throws Exception {
    throw new Exception();
  }
}
\$\endgroup\$
  • 1
    \$\begingroup\$ This isn't a complete program or function. \$\endgroup\$ – Pavel Jan 27 '17 at 18:26
  • \$\begingroup\$ Also the complete program contains a and v \$\endgroup\$ – Metoniem Feb 21 '17 at 10:34
  • \$\begingroup\$ @Metoniem then that would means it's impossible in java since you always have main \$\endgroup\$ – Walfrat Feb 21 '17 at 11:40
0
\$\begingroup\$

dc, 6 bytes

Eo194p

Outputs DC. Alternatively, so does this:

Fo207p

The only bases in which dc can output the letter D as part of a number are 14, 15 and 16, but I don't know if it's possible to express 16 using a single byte.

\$\endgroup\$
0
\$\begingroup\$

C (gcc), 0 bytes

<Yep, you read it right, 0 bytes.>

According to TIO, it outputs:

usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
/srv/wrappers/c-gcc: line 5: ./.bin.tio: No such file or directory
\$\endgroup\$
  • \$\begingroup\$ Good use of gcc arguing when theres absolutely nothing. \$\endgroup\$ – Matthew Roh Feb 5 '17 at 14:45
0
\$\begingroup\$

REXX, 21 bytes

parse version a
say a

Will give something like

REXX-Regina_3.9.1(MT) 5.00 5 Apr 2015

or

ARexx V1.15 68070 68881 PAL 50HZ
\$\endgroup\$
0
\$\begingroup\$

Erlang, 0 bytes

As many other languages, starting the interactive interpreter shows the language name and version.

\$\endgroup\$
0
\$\begingroup\$

Rexx (Regina), 32 bytes

say d2c(82)d2c(69)d2c(88)d2c(88)

Try it online!

\$\endgroup\$
0
\$\begingroup\$

TeX and variants (0 bytes)

Inputting an empty file or just running tex on the command line leads to an output on the console screen starting with

This is TeX, Version 3.14159265

This also works for pdfTeX, LuaTeX and XeTeX, but not for the LaTeX-variants (the "La" doesn't get printed).

Since this is TeX, I would like to also be able to produce a DVI or PDF with the TeX logo in it, but I have not yet been able to find a way around the restrictions. Simply \TeX\bye for plain TeX does work, but contains all letters in the name at least once. The LaTeX variant is even worse with \documentclass{book}\begin{document}\LaTeX\end{document}, which contains the e 6 times. For both, commands containing an e are obligatory to have a valid document. Maybe there's a way around this with some smart redefinitions, but since many macros in TeX contain the letter e I doubt it will be easy.

\$\endgroup\$
  • \$\begingroup\$ You can use TeX's ^^ replacing mechanism to insert characters without explicitly typing them (see full explanation here). This leads to \^^54^^%^^58\^^%nd as the shortest full TeX document solution, IMO. \$\endgroup\$ – siracusa Mar 27 '18 at 10:16
0
\$\begingroup\$

q/kdb+, 6 bytes

Solution:

.Q.x10

Example:

q).Q.x10
@["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"]0x40\:

Explanation:

.Q.x10 returns a function you could use for some base64 encoding, calling without parameters outputs the function body.

Bonus:

22 bytes gets us a purer answer. Here we cast ("c"$) integers (113 47 107 100 98 43) to ASCII chars:

q)"c"$43+70 4 64 57 55 0
"q/kdb+"
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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