57
\$\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\$
15
  • 8
    \$\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\$ Jan 24, 2017 at 23:47
  • 9
    \$\begingroup\$ Obligatory "Just having your code be blank but have a flag like --version isn't allowed"? \$\endgroup\$
    – Value Ink
    Jan 25, 2017 at 0:00
  • 106
    \$\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, 2017 at 0:47
  • 20
    \$\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, 2017 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, 2017 at 18:30

169 Answers 169

1
\$\begingroup\$

Excel 2010 VBA 113 bytes

I am assuming paragraph spacing is 1 byte. This won't work with earlier versions of Excel. For those who dont have/use Excel, column 14925 is VBA

n = 14925
Do While n > 0
c = ((n - 1) Mod 26)
s = Chr(c + 65) & s
n = (n - c) \ 26
Loop
Debug.Print s

Credit where credit is due.

\$\endgroup\$
2
  • \$\begingroup\$ Welcome to PPCG! For further reference, you don't need to CW-ify an answer if you didn't make it. Simply linking to the source works. Also, you should probably post the plain VBA answer separately. \$\endgroup\$
    – Riker
    Jan 25, 2017 at 16:13
  • \$\begingroup\$ @EasterlyIrk Ok, I didn't know if it was necessary or not to CW an answer but I wouldn't feel right if I didnt .. the plain VBA answer I will leave, I made that within the first minute of reading the question and found it uninteresting \$\endgroup\$
    – Mr.Burns
    Jan 25, 2017 at 16:18
1
\$\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\$
1
  • \$\begingroup\$ As all kind of garbage is accepted around the name: p:rUBY. \$\endgroup\$
    – manatwork
    Jan 25, 2017 at 14:54
1
\$\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\$
7
  • 5
    \$\begingroup\$ Your code is invalid, it contains t & a \$\endgroup\$ Jan 25, 2017 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, 2017 at 14:03
  • 1
    \$\begingroup\$ and the c in EMCAScript \$\endgroup\$ Jan 25, 2017 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\$ Jan 26, 2017 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\$ Jan 26, 2017 at 15:18
1
\$\begingroup\$

PowerShell, 2 bytes

gv

Sample output:

Name                           Value
----                           -----
$                              $gv
?                              True
^                              $gv
args                           {}
ChocolateyProfile              C:\ProgramData\chocolatey\helpers\chocolateyProfile.psm1
ChocolateyTabSettings          @{AllCommands=False}
ConfirmPreference              High
ConsoleFileName
DebugPreference                SilentlyContinue
Error                          {System.Management.Automation.ParseException: At line:1 char:11...
ErrorActionPreference          Continue
ErrorView                      NormalView
ExecutionContext               System.Management.Automation.EngineIntrinsics
false                          False
FormatEnumerationLimit         4
HOME                           C:\Users\username
Host                           System.Management.Automation.Internal.Host.InternalHost
input                          System.Collections.ArrayList+ArrayListEnumeratorSimple
MaximumAliasCount              4096
MaximumDriveCount              4096
MaximumErrorCount              256
MaximumFunctionCount           4096
MaximumHistoryCount            4096
MaximumVariableCount           4096
MyInvocation                   System.Management.Automation.InvocationInfo
NestedPromptLevel              0
null
OutputEncoding                 System.Text.ASCIIEncoding
PID                            7912
PROFILE                        \\thing\user$\user_folders\username\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
ProgressPreference             Continue
PSBoundParameters              {}
PSCommandPath                  \\thing\user$\user_folders\username\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
PSCulture                      en-AU
PSDefaultParameterValues       {}
PSEmailServer
PSHOME                         C:\Windows\System32\WindowsPowerShell\v1.0
PSScriptRoot                   \\thing\user$\user_folders\username\My Documents\WindowsPowerShell
PSSessionApplicationName       wsman
PSSessionConfigurationName     http://schemas.microsoft.com/powershell/Microsoft.PowerShell
PSSessionOption                System.Management.Automation.Remoting.PSSessionOption
PSUICulture                    en-US
PSVersionTable                 {PSVersion, WSManStackVersion, SerializationVersion, CLRVersion...}
PWD                            C:\Windows\system32
ShellId                        Microsoft.PowerShell
StackTrace                        at CallSite.Target(Closure , CallSite , Object )...
true                           True
VerbosePreference              SilentlyContinue
WarningPreference              Continue
WhatIfPreference               False

This is shorthand for the cmdlet Get-Variable, which displays the name and value of all variables in scope. Among these are a few environment variables which are also regular variables, like $PSHOME and $PROFILE which contains paths for powershell to run in, and where to find the script to run for every new session.

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

GNU M4, 5 bytes

dnl()

Output:

m4:stdin:1: Warning: excess arguments to builtin `dnl' ignored

GNU M4, 10 bytes, clean output

m`'incr(3)

Output:

m4

GNU M4, 40 bytes, clean output, correct case

translit(ulinzg,a-z,z-a)(%c,77)`'incr(3)

Output:

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

Hoon, 13 bytes

`@t`0w1.KrSZ8

Hoon has an atom encoding @uw, which is base-64. This simply casts an @uw literal back to a cord (@t), which is the value 'Hoon'

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

PHP, 1 byte

_

This leads to a parse error. Run like this:

php -r '_'
> PHP Parse error:  syntax error, unexpected end of file in Command line code on line 1

Version without resorting to STDERR (8 bytes)

Note: uses IBM-850 encoding

<?=~»À»;

Run like this:

echo '<?=~»À»;' | php 2>/dev/null
> PHP

This just uses the binary opposite of PHP, and negates it using the ~ operator.

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

QBIC, 15 6 bytes

The way to do this without errors and with the proper capitalisation costs 15 bytes:

?ucase$(@qbic`)

Since QBIC is in all-caps, this code is allowed: it takes the string literal qbic and prints it in uppercase.

An error-output (which feels kinda cheaty to me) is shorter:

?b(12)

In 6 bytes, we can put QBIC encountered error: 9 on the screen, signifying an out-of-bounds error. See here why.

There's also this 6-byter that prints QBIC in lowercase:

?@qbic

That string literal doesn't need a closing backtick, it is auto-closed because of EOF.

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

dc, 6 bytes

A0P99P

Prints the ASCII values 100 and 99, i.e. dc.

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

C++, 84 44 bytes

#import<stdio.h>
main(){puts("\103\53\53");}

Thanks to @Clearer for saving a lot of bytes.

\$\endgroup\$
5
  • \$\begingroup\$ This isn't a valid C++ program. Try this instead: #include<cstdio> int main(){char c[]={67,43,43,0};printf(c);} It's shorter and correct C++. \$\endgroup\$
    – Clearer
    Feb 14, 2017 at 1:51
  • \$\begingroup\$ @Clearer Yes, that's what I would have done, but like I said, I wanted to completely avoid using the character c, upper or lower case. As this does compile on the MinGW compiler I'm using, and I don't think there is any undefined behaviour, it is valid at least on one implementation. (Which is enough for code golf) \$\endgroup\$
    – Steadybox
    Feb 14, 2017 at 14:46
  • \$\begingroup\$ It's not valid just because it compiles on a particular compiler. You're lacking the return type of your main function, which is the only thing that's a problem -- it is a valid C program though. You can shave off a byte by writing uint8_t l[] =..., instead of uint8_t l[4]=... \$\endgroup\$
    – Clearer
    Feb 15, 2017 at 12:24
  • \$\begingroup\$ #include<stdio.h> int main(){puts("\103\53\53");} only has the problem that it depends on being able to print ASCII compatible text. It's just 50 bytes long. If you allow c in the program, you can shave it to 49 and be equal to the Java 8 version but include a newline in the output :-) \$\endgroup\$
    – Clearer
    Feb 15, 2017 at 12:43
  • \$\begingroup\$ Thanks for the shorter version. I'm still omitting the return type of main, since that is allowed by certain compilers, and in code golf, languages are defined by their implementation: meta.codegolf.stackexchange.com/questions/7832/… \$\endgroup\$
    – Steadybox
    Feb 20, 2017 at 11:56
1
\$\begingroup\$

Rexx (Regina), 32 bytes

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

Try it online!

\$\endgroup\$
1
\$\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\$
1
\$\begingroup\$

Java 8, 49 41 bytes

Golfed:

n->System.out.println("\112\141\166\141")

Ungolfed, full program:

public class OutputProgrammingLanguageName {

  public static void main(String[] args) {
    f(n->System.out.println("\112\141\166\141"));
  }

  private static void f(java.util.function.IntConsumer f) {
    f.accept(0);
  }
}

This is a simple System.out.println() wrapped in a functional interface to save some bytes, using octal escapes to avoid any of the character literals in "Java". Note that on some JVM implementations, System.out.print() does not necessarily flush output. In that case, the program will try to print but nothing is output before the program ends. Using System.out.println() requires two additional bytes, but guarantees the program actually prints something.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ You can change println to print \$\endgroup\$
    – FlipTack
    Jan 25, 2017 at 18:15
  • 1
    \$\begingroup\$ @FlipTack I have had problems in previous challenges with flushing of stdout, where a program will print nothing and exit. I will take the two byte hit to the score for a guarantee that the program will actually output something. \$\endgroup\$
    – user18932
    Jan 25, 2017 at 18:16
  • \$\begingroup\$ print seems to work fine for me, but nvm \$\endgroup\$
    – FlipTack
    Jan 25, 2017 at 18:33
  • \$\begingroup\$ Since you're just printing a String you can use octal escapes instead of unicode escapes. Saves 8 bytes. System.out.println("\112\141\166\141"); \$\endgroup\$
    – Poke
    Jun 29, 2017 at 21:03
1
\$\begingroup\$

Noether, 15 bytes

"n"UP"OETHER"_P

Try it here!

Explanation:

"n"      - Push the string "n"
U        - Convert the string on top of the stack to uppercase
P        - Print the top of the stack
"OETHER" - Push the string "OETHER"
_        - Convert the string on top of the stack to lowercase
P        - Print the top of the stack
\$\endgroup\$
1
\$\begingroup\$

Swift, 1 byte

!

outputs:

error.swift:1:1: error: unary operator cannot be separated from its operand
!
^

error.swift:2:1: error: expected expression

^

This just has to be run from a source file with the preferred file extension, .swift. The repl reports repl.swift as the source file, so that works too.

\$\endgroup\$
2
  • \$\begingroup\$ Isn't S in both Swift and Set? \$\endgroup\$
    – boboquack
    Jan 26, 2017 at 2:26
  • \$\begingroup\$ @boboquack Whoooops. I'll have to find another generic type with a short name \$\endgroup\$
    – Alexander
    Jan 26, 2017 at 2:27
1
\$\begingroup\$

4, 1 byte

3

Using this ruby implemtation from the esolangs' page, any program that doesn't matches /^3\.\d*4$/ will print

SyntaxError: Program must begin '3.' and end '4'.
\$\endgroup\$
1
\$\begingroup\$

Quetzalcoatl, 0 + 1 for -n flag = 1 byte

<no code>
\$\endgroup\$
1
\$\begingroup\$

Chip-8, 22 bytes.

0xA212
0xD003
0xA215
0x6108
0xD103
0xF00A
0xD59D
0xD560
0x6C40

I hope this counts. Does not contain bytes corresponding to C, h, i, p, -, or 8 in ASCII.

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

Javascript (in Firefox), 627 bytes

Doesn't use JavaScript's letters upper or lowercase. Only works in Firefox because it uses eb() function as a method of getting a "p". It also needs the popup blocker to be disabled.

f=!1+[];n=1E309+[];h=!0+[];d=(eb+[])[3];o={b:1};g=d+"on"+f[3]+h[0]+h[1]+"u"+d+h[0]+"o"+h[1];q=(/b/[g]+[])[14];l=[][g][g];k=o[g]["key"+f[3]](l(h[1]+"e"+h[0]+"u"+h[1]+"n o"+q+'en("")')());u=k["f"+n[3]+"l"+h[0]+"e"+h[1]](l("b",h[1]+"e"+h[0]+"u"+h[1]+"n 0==b."+n[3]+'ndexOf("on'+n[3]+'n")&&"l"==b[6]'))[0];e=k["f"+n[3]+"l"+h[0]+"e"+h[1]](l("b",h[1]+"e"+h[0]+"u"+h[1]+"n-1!=b."+n[3]+'ndexOf("omm'+u[5]+"nd"+f[3]+'")'))[0][6];m=o[g]["n"+f[1]+"me"][2][h[0]+"oU"+q+q+"e"+h[1]+e+u[5]+f[3]+"e"]();l(h[1]+"e"+h[0]+"u"+h[1]+"n "+d+"on"+f[3]+"ole")().log(m+u[5]+u[4]+u[5]+f[3][h[0]+"oU"+q+q+"e"+h[1]+e+u[5]+f[3]+"e"]()+d+h[1]+n[3]+q+h[0]);

Ungolfed version:

f = !1+[];
n = 1E309+[];
h = !0+[];
d = (eb+[])[3];
o = {b:1};
g = d+"on"+f[3]+h[0]+h[1]+"u"+d+h[0]+"o"+h[1];
q = (/a/[g]+[])[14]
l = [][g][g];
k=o[g]["key"+f[3]](l(h[1]+'e'+h[0]+'u'+h[1]+'n o'+q+'en("")')());
u = k["f"+n[3]+"l"+h[0]+"e"+h[1]](l("b",h[1]+'e'+h[0]+'u'+h[1]+'n 0==b.'+n[3]+'ndexOf("on'+n[3]+'n")&&"l"==b[6]'))[0];

e = k["f"+n[3]+"l"+h[0]+"e"+h[1]](l("b",h[1]+'e'+h[0]+'u'+h[1]+'n-1!=b.'+n[3]+'ndexOf("omm'+u[5]+'nd'+f[3]+'")'))[0][6];
m = o[g]["n"+f[1]+"me"][2][h[0]+"oU"+q+q+"e"+h[1]+e+u[5]+f[3]+"e"]();;
l(h[1]+'e'+h[0]+'u'+h[1]+'n '+d+"on"+f[3]+"ole")().log(m+u[5]+u[4]+u[5]+f[3][h[0]+"oU"+q+q+"e"+h[1]+e+u[5]+f[3]+"e"]()+d+h[1]+n[3]+q+h[0]);
\$\endgroup\$
1
  • 1
    \$\begingroup\$ What is eb? I'm using Firefox and it doesn't seem to exist. \$\endgroup\$
    – 12Me21
    Nov 24, 2018 at 15:39
1
\$\begingroup\$

brainfuck, 79 bytes

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

Try it online!

It's not the shortest brainfuck submission, that would be @Sp3000's answer, but frankly, I dont understand how his submission works anyways, and this was the best I could do.

Explanation:

The word "brainfuck" is 9 letters: b(98), r(114), a(97), i(105), n(110), f(102), u(117), c(99), and k(107) Splitting these up into three groups by similar ascii values gives us our tape:

[Initial Count Cell] , [ABCF Cell] , [RU Cell] , [IKN Cell]

By using three cells instead of one to print the ascii characters, we cut down the number of bytes needed by nearly half.

-[>++>++>++<<<-----]     Wrapped loop sets all three ascii cells to 102
>----.                   print 'b'
>++++++++++++.           print 'r'
<-.                      print 'a'
>>+++.                   print 'i'
+++++.                   print 'n'
<<+++++.                 print 'f'
>+++.                    print 'u'
<---.                    print 'c'
>>---.                   print 'k'

Output:

brainfuck

Credits: -2 bytes thanks to @ETHproductions

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Very good simple answer, using a relatively short yet easy to understand algorithm. I believe you can save two bytes by using ABCF IKN RU instead: Try it online! \$\endgroup\$ Mar 26, 2018 at 3:00
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\$
9
  • \$\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, 2018 at 9:33
  • \$\begingroup\$ Maybe .chars instead of .bytes? p 'Qtax'.chars.map{|x|x.next}.join \$\endgroup\$
    – manatwork
    Mar 27, 2018 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, 2018 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, 2018 at 9:39
  • \$\begingroup\$ @manatwork AAARRRGGGHHH! I forgot about succ. That's so much better! Thanks! :@) \$\endgroup\$
    – AJFaraday
    Mar 27, 2018 at 9:40
1
\$\begingroup\$

Perl 5, 1 bytes

Includes +1 for -v

Try it online!

(the body is empty). This includes both perl and Perl. But I'm going to assume the language name is perl from here on. It's what perl's own version string says the name is after all.

This is of course totally boring. Somewhat more interesting:

Perl 5, 6 bytes

say$^X

Try it online!

This assumes the name of the executable contains perl. I've yet to see an install where this is not so.

Perl 5, 11 bytes

say"\LPERL"

Try it online!

Uses the fact that case variations don't count. I couldn't use lc because it contains l. Still boring

Perl 5, 12 bytes

say FSDZ^6x4

Try it online!

This one clean but long

\$\endgroup\$
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\$
1
  • \$\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\$ Jan 25, 2017 at 20:25
1
\$\begingroup\$

jq, 1 byte

a

Output:

jq: error: a/0 is not defined at <top-level>, line 1:
a
jq: 1 compile error
\$\endgroup\$
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\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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