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\$
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\$ – 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
  • 92
    \$\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

142 Answers 142

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 '17 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 '17 at 18:16
  • \$\begingroup\$ print seems to work fine for me, but nvm \$\endgroup\$ – FlipTack Jan 25 '17 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 '17 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 '17 at 2:26
  • \$\begingroup\$ @boboquack Whoooops. I'll have to find another generic type with a short name \$\endgroup\$ – Alexander Jan 26 '17 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\$

Ly, 10 bytes

(76)(89)&o

Pretty easy with Ly, due to the short name and little use of letters.

Outputs:

LY

Try it online!

\$\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
  • \$\begingroup\$ What is eb? I'm using Firefox and it doesn't seem to exist. \$\endgroup\$ – 12Me21 Nov 24 '18 at 15:39
1
\$\begingroup\$

Julia, 28 bytes

show("\x6A\x75\x6C\x69\x61")

As it turned out, the hardest part wasn't encoding the string (easy enough with escapes and an ASCII table), but finding a function in the standard library to show it. Most of them have one of the letters of ['a', 'i', 'j', 'l', 'u'] in them.

\$\endgroup\$
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\$ – ETHproductions Mar 26 '18 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 '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\$
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\$ – 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\$

Turing Machine But Way Worse, 3813 bytes

0 0 0 1 1 0 0
0 1 1 1 2 0 0
0 2 0 1 3 0 0
0 3 1 1 4 0 0
0 4 0 1 5 0 0
0 5 1 1 6 0 0
0 6 0 1 7 0 0
0 7 0 1 8 1 0
0 8 0 1 9 0 0
0 9 1 1 10 0 0
0 10 1 1 11 0 0
0 11 1 1 12 0 0
0 12 0 1 13 0 0
0 13 1 1 14 0 0
0 14 0 1 15 0 0
0 15 1 1 16 1 0
0 16 0 1 17 0 0
0 17 1 1 18 0 0
0 18 1 1 19 0 0
0 19 1 1 20 0 0
0 20 0 1 21 0 0
0 21 0 1 22 0 0
0 22 1 1 23 0 0
0 23 0 1 24 1 0
0 24 0 1 25 0 0
0 25 1 1 26 0 0
0 26 1 1 27 0 0
0 27 0 1 28 0 0
0 28 1 1 29 0 0
0 29 0 1 30 0 0
0 30 0 1 31 0 0
0 31 1 1 32 1 0
0 32 0 1 33 0 0
0 33 1 1 34 0 0
0 34 1 1 35 0 0
0 35 0 1 36 0 0
0 36 1 1 37 0 0
0 37 1 1 38 0 0
0 38 1 1 39 0 0
0 39 0 1 40 1 0
0 40 0 1 41 0 0
0 41 1 1 42 0 0
0 42 1 1 43 0 0
0 43 0 1 44 0 0
0 44 0 1 45 0 0
0 45 1 1 46 0 0
0 46 1 1 47 0 0
0 47 1 1 48 1 0
0 48 0 1 49 0 0
0 49 0 1 50 0 0
0 50 1 1 51 0 0
0 51 0 1 52 0 0
0 52 0 1 53 0 0
0 53 0 1 54 0 0
0 54 0 1 55 0 0
0 55 0 1 56 1 0
0 56 0 1 57 0 0
0 57 1 1 58 0 0
0 58 0 1 59 0 0
0 59 0 1 60 0 0
0 60 1 1 61 0 0
0 61 1 1 62 0 0
0 62 0 1 63 0 0
0 63 1 1 64 1 0
0 64 0 1 65 0 0
0 65 1 1 66 0 0
0 66 1 1 67 0 0
0 67 0 1 68 0 0
0 68 0 1 69 0 0
0 69 0 1 70 0 0
0 70 0 1 71 0 0
0 71 1 1 72 1 0
0 72 0 1 73 0 0
0 73 1 1 74 0 0
0 74 1 1 75 0 0
0 75 0 1 76 0 0
0 76 0 1 77 0 0
0 77 0 1 78 0 0
0 78 1 1 79 0 0
0 79 1 1 80 1 0
0 80 0 1 81 0 0
0 81 1 1 82 0 0
0 82 1 1 83 0 0
0 83 0 1 84 0 0
0 84 1 1 85 0 0
0 85 0 1 86 0 0
0 86 0 1 87 0 0
0 87 0 1 88 1 0
0 88 0 1 89 0 0
0 89 1 1 90 0 0
0 90 1 1 91 0 0
0 91 0 1 92 0 0
0 92 1 1 93 0 0
0 93 0 1 94 0 0
0 94 0 1 95 0 0
0 95 1 1 96 1 0
0 96 0 1 97 0 0
0 97 1 1 98 0 0
0 98 1 1 99 0 0
0 99 0 1 100 0 0
0 100 1 1 101 0 0
0 101 1 1 102 0 0
0 102 1 1 103 0 0
0 103 0 1 104 1 0
0 104 0 1 105 0 0
0 105 1 1 106 0 0
0 106 1 1 107 0 0
0 107 0 1 108 0 0
0 108 0 1 109 0 0
0 109 1 1 110 0 0
0 110 0 1 111 0 0
0 111 1 1 112 1 0
0 112 0 1 113 0 0
0 113 0 1 114 0 0
0 114 1 1 115 0 0
0 115 0 1 116 0 0
0 116 0 1 117 0 0
0 117 0 1 118 0 0
0 118 0 1 119 0 0
0 119 0 1 120 1 0
0 120 0 1 121 0 0
0 121 1 1 122 0 0
0 122 0 1 123 0 0
0 123 0 1 124 0 0
0 124 0 1 125 0 0
0 125 0 1 126 0 0
0 126 1 1 127 0 0
0 127 0 1 128 1 0
0 128 0 1 129 0 0
0 129 1 1 130 0 0
0 130 1 1 131 0 0
0 131 1 1 132 0 0
0 132 0 1 133 0 0
0 133 1 1 134 0 0
0 134 0 1 135 0 0
0 135 1 1 136 1 0
0 136 0 1 137 0 0
0 137 1 1 138 0 0
0 138 1 1 139 0 0
0 139 1 1 140 0 0
0 140 0 1 141 0 0
0 141 1 1 142 0 0
0 142 0 1 143 0 0
0 143 0 1 144 1 0
0 144 0 1 145 0 0
0 145 0 1 146 0 0
0 146 1 1 147 0 0
0 147 0 1 148 0 0
0 148 0 1 149 0 0
0 149 0 1 150 0 0
0 150 0 1 151 0 0
0 151 0 1 152 1 0
0 152 0 1 153 0 0
0 153 1 1 154 0 0
0 154 0 1 155 0 0
0 155 1 1 156 0 0
0 156 0 1 157 0 0
0 157 1 1 158 0 0
0 158 1 1 159 0 0
0 159 1 1 160 1 0
0 160 0 1 161 0 0
0 161 1 1 162 0 0
0 162 1 1 163 0 0
0 163 0 1 164 0 0
0 164 0 1 165 0 0
0 165 0 1 166 0 0
0 166 0 1 167 0 0
0 167 1 1 168 1 0
0 168 0 1 169 0 0
0 169 1 1 170 0 0
0 170 1 1 171 0 0
0 171 1 1 172 0 0
0 172 1 1 173 0 0
0 173 0 1 174 0 0
0 174 0 1 175 0 0
0 175 1 1 176 1 0
0 176 0 1 177 0 0
0 177 0 1 178 0 0
0 178 1 1 179 0 0
0 179 0 1 180 0 0
0 180 0 1 181 0 0
0 181 0 1 182 0 0
0 182 0 1 183 0 0
0 183 0 1 184 1 0
0 184 0 1 185 0 0
0 185 1 1 186 0 0
0 186 0 1 187 0 0
0 187 1 1 188 0 0
0 188 0 1 189 0 0
0 189 1 1 190 0 0
0 190 1 1 191 0 0
0 191 1 1 192 1 0
0 192 0 1 193 0 0
0 193 1 1 194 0 0
0 194 1 1 195 0 0
0 195 0 1 196 0 0
0 196 1 1 197 0 0
0 197 1 1 198 0 0
0 198 1 1 199 0 0
0 199 1 1 200 1 0
0 200 0 1 201 0 0
0 201 1 1 202 0 0
0 202 1 1 203 0 0
0 203 1 1 204 0 0
0 204 0 1 205 0 0
0 205 0 1 206 0 0
0 206 1 1 207 0 0
0 207 0 1 208 1 0
0 208 0 1 209 0 0
0 209 1 1 210 0 0
0 210 1 1 211 0 0
0 211 1 1 212 0 0
0 212 0 1 213 0 0
0 213 0 1 214 0 0
0 214 1 1 215 0 0
0 215 1 1 216 1 0
0 216 0 1 217 0 0
0 217 1 1 218 0 0
0 218 1 1 219 0 0
0 219 0 1 220 0 0
0 220 0 1 221 0 0
0 221 1 1 222 0 0
0 222 0 1 223 0 0
0 223 1 1 224 1 1

Try it online!

Little surprised I didn't see this here already.

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

MarioLANG, 212 bytes

+>+>+>+>+>->->-
+"+"+"+"+"-"-"-
+++++++++-----.
+++++++.+-.-.-
+++++++-+-+-+-
+++++++-+-+-+-
+++++++-+-+-+-
+++++++-+-+-+.
++++++.-+.+-++
++++++--+++-++
++++++--++..++
++++++--++--++
+!+!+!-!+!-!+!
=#=#=#=#=#=#=#

Try it online!

This answer quite simply increments and decrements the value in one cell. I'm pretty sure this is the shortest you can get without loops - I might look at an answer using loops later.

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

Rail, 35 bytes

$ 'main'
 -[q]?3c(!!)2co\
  #oc1?n(!!)oc5?-&

Try it online!

Here's an expanded version:

 $ 'expanded'
 \
  --[any string]-?-3c-(!discard!)-2c-o\
                                       \
          #-o-c1-?n---(!discard!)-o-c5?--&

Rail works like a train track, with special 'stations' (functions) represented by characters that operate on values from the stack.

This pushes a string ("q" in the short one, "any string" in the long one), and then gets its type ("string"), which has an r in. It then cuts the string up to just get the r, and prints that to stdout.

It then creates an empty lambda, gets its type ("lambda"), which has an a in it, cuts the first 5 letters out, and prints the last a.

It then pushes nil (the empty list) to the stack, with n, gets its type ("nil"), gets the il and prints that.

The special character stations used are as follows:

  • [q], [any string]: push a literal string
  • ?: pop a value, push its type
  • 3: the literal value "3"
  • c: pop a, b; cut the string at the ath position and push back both halves
  • (!!): pop a value and store it in the variable with name in between the !s.
  • o: pop the stack and print its value to Standard Output
  • \, -: rails
  • &: push a lambda to the stack, and turn the train around a half turn
  • n: push nil to the stack.
  • #: terminate the program

Fun fact, in the expanded version, the second instance of the variable assignment to discard is actually assigning to dracsid, because the order you go through a station matters. The characters are read individually by the train as it goes through. This doesn't matter, because it's just being used to pop values off the stack and never use them again.

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

W, 3 bytes

I'll see which is compressable, I am not permitted to use the compressor yet.

Convery 87 to a character.

87C

W, 3 bytes

Output every character between 'a' and 0x00. It maps over the (implicit input) 0 converted to a character to the letter 'a'.

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

Keg, -v 0 bytes

Prints:

Keg Last Updated On: Wednesday 15 January 2020

Well, at least using commit 8b6ad216c1fc60e59bd143ba2ee0571df29db2f6 it does. The date part changes between commits. Why? Because -v prints out the current interpreter version.

A 3 byte answer:

ǨƐƓ

Try it online!

Prints:

keg

A 6 byte answer:

L;f;h;

Try it online!

Prints:

Keg

The 3 byter uses the push'n'print part of Keg, and the 6 byter pushes each letter and decrements it to get the correct letter.

\$\endgroup\$
1
  • \$\begingroup\$ of course the obligatory -version comment \$\endgroup\$ – PkmnQ Mar 8 '20 at 6:49
1
\$\begingroup\$

Pyth, 4 Bytes

"pYTH

Simple prints the string pYTH to stdout.

\$\endgroup\$
1
  • \$\begingroup\$ This is 5 bytes, " p Y T H \$\endgroup\$ – Samathingamajig Nov 13 '20 at 3:46
1
\$\begingroup\$

Rust, 0 bytes (compile time) / 18 bytes (run time)

Compile time, 0 bytes

Complier output:

error[E0601]: `main` function not found in crate `empty`
  |
  = note: consider adding a `main` function to `empty.rs`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0601`.

Run time, 18 bytes

fn main(){todo!()}

Output:

thread 'main' panicked at 'not yet implemented', panic.rs:1:11
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Unfortunately, panicking via array indices

fn main(){[][1]}

doesn't work, because rustc catches the error at compile time.

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

C (gcc), 5 bytes

main;

Try it online!

  • Output "type defaults to ‘int’ in declaration of ‘main’" to stderr while compile.
  • Output "Segmentation fault (core dumped)" to stderr while execute.

-2 bytes, thanks to ceilingcat

\$\endgroup\$
0
1
+50
\$\begingroup\$

Forth (gforth), 1 byte

]

Try it online!

] switches to compile state, causing following words to be executed with their compilation semantics... and apparently, if the program never returns to interpret state, also causing it to output

Gforth 0.7.3, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit

I thought maybe there was some chance I could get around having to create a definition to use loops for another challenge, but this works too.

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

Pxem, (See below)

Depends on invokation

pxemi.7z, 0 bytes (on invokation).

Compile the source code in C++ and run the interpreter with no arguments, like this: /path/to/pxemi. The following line is output to stderr: usage: pxemi pxemFileName.

RPxem, 0 bytes (on invokation)

Just like nk.'s pxemi, run with no arguments: Usage: rpxem path-to-pxem-file.pxe can be seen.

Programs

Pxem, 6 bytes of filename only, case-insensitive, boring.

  • Filename: pXEM.p.
  • Content: none.

Pxem, 18 bytes of filename only, case-sensitive output, depends on ASCII-compatible filesystem.

  • Filename: @-.+23.+7A.+%+.+.p
  • Content: None
How it works

On every ??.+ each character is generated with sum of two characters' ASCII code from backwards.

\$\endgroup\$
1
  • \$\begingroup\$ Pxem is interesting. \$\endgroup\$ – PkmnQ Mar 19 at 10:09
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\$
1
  • \$\begingroup\$ You can't use P, A, S, C, A or L in your source code. \$\endgroup\$ – Clearer Feb 14 '17 at 1:49

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.