46
\$\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\$
  • 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
  • 90
    \$\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

135 Answers 135

4
\$\begingroup\$

Vim, 3 bytes

:h<CR>

Try it online!

This opens up the default help file and outputs:

*help.txt*  For Vim version 7.4.  Last change: 2016 Mar 31

                        VIM - main help file
                                                                         k
      Move around:  Use the cursor keys, or "h" to go left,        h   l
                    "j" to go down, "k" to go up, "l" to go right.   j
Close this window:  Use ":q<Enter>".
   Get out of Vim:  Use ":qa!<Enter>" (careful, all changes are lost!).

Jump to a subject:  Position the cursor on a tag (e.g. |bars|) and hit CTRL-].
   With the mouse:  Double-click the left mouse button on a tag, e.g. |bars|.
        Jump back:  Type CTRL-T or CTRL-O.  Repeat to go further back.

Get specific help:  It is possible to go directly to whatever you want help
                    on, by giving an argument to the |:help| command.
                    Prepend something to specify the context:  *help-context*

                          WHAT          PREPEND    EXAMPLE  ~
                      Normal mode command          :help x
                      Visual mode command     v_       :help v_u
                      Insert mode command     i_       :help i_<Esc>
                      Command-line command    :    :help :quit
                      Command-line editing    c_       :help c_<Del>
                      Vim command argument    -    :help -r
                      Option              '    :help 'textwidth'
                      Regular expression      /    :help /[
                    See |help-summary| for more contexts and an explanation.

  Search for help:  Type ":help word", then hit CTRL-D to see matching
                    help entries for "word".
                    Or use ":helpgrep word". |:helpgrep|

VIM stands for Vi IMproved.  Most of VIM was made by Bram Moolenaar, but only
through the help of many others.  See |credits|.
------------------------------------------------------------------------------
                                                *doc-file-list* *Q_ct*
BASIC:
|quickref|  Overview of the most common commands you will use
|tutor|     30 minutes training course for beginners
|copying|   About copyrights
|iccf|      Helping poor children in Uganda
|sponsor|   Sponsor Vim development, become a registered Vim user
|www|       Vim on the World Wide Web
|bugs|      Where to send bug reports

USER MANUAL: These files explain how to accomplish an editing task.

|usr_toc.txt|   Table Of Contents

Getting Started ~
|usr_01.txt|  About the manuals
|usr_02.txt|  The first steps in Vim
|usr_03.txt|  Moving around
|usr_04.txt|  Making small changes
|usr_05.txt|  Set your settings
|usr_06.txt|  Using syntax highlighting
|usr_07.txt|  Editing more than one file
|usr_08.txt|  Splitting windows
|usr_09.txt|  Using the GUI
|usr_10.txt|  Making big changes
|usr_11.txt|  Recovering from a crash
|usr_12.txt|  Clever tricks

Editing Effectively ~
|usr_20.txt|  Typing command-line commands quickly
|usr_21.txt|  Go away and come back
|usr_22.txt|  Finding the file to edit
|usr_23.txt|  Editing other files
|usr_24.txt|  Inserting quickly
|usr_25.txt|  Editing formatted text
|usr_26.txt|  Repeating
|usr_27.txt|  Search commands and patterns
|usr_28.txt|  Folding
|usr_29.txt|  Moving through programs
|usr_30.txt|  Editing programs
|usr_31.txt|  Exploiting the GUI
|usr_32.txt|  The undo tree

Tuning Vim ~
|usr_40.txt|  Make new commands
|usr_41.txt|  Write a Vim script
|usr_42.txt|  Add new menus
|usr_43.txt|  Using filetypes
|usr_44.txt|  Your own syntax highlighted
|usr_45.txt|  Select your language


REFERENCE MANUAL: These files explain every detail of Vim.  *reference_toc*

General subjects ~
|intro.txt| general introduction to Vim; notation used in help files
|help.txt|  overview and quick reference (this file)
|helphelp.txt|  about using the help files
|index.txt| alphabetical index of all commands
|help-tags| all the tags you can jump to (index of tags)
|howto.txt| how to do the most common editing tasks
|tips.txt|  various tips on using Vim
|message.txt|   (error) messages and explanations
|quotes.txt|    remarks from users of Vim
|develop.txt|   development of Vim
|debug.txt| debugging Vim itself
|uganda.txt|    Vim distribution conditions and what to do with your money

Basic editing ~
|starting.txt|  starting Vim, Vim command arguments, initialisation
|editing.txt|   editing and writing files
|motion.txt|    commands for moving around
|scroll.txt|    scrolling the text in the window
|insert.txt|    Insert and Replace mode
|change.txt|    deleting and replacing text
|indent.txt|    automatic indenting for C and other languages
|undo.txt|  Undo and Redo
|repeat.txt|    repeating commands, Vim scripts and debugging
|visual.txt|    using the Visual mode (selecting a text area)
|various.txt|   various remaining commands
|recover.txt|   recovering from a crash

Advanced editing ~
|cmdline.txt|   Command-line editing
|options.txt|   description of all options
|pattern.txt|   regexp patterns and search commands
|map.txt|   key mapping and abbreviations
|tagsrch.txt|   tags and special searches
|quickfix.txt|  commands for a quick edit-compile-fix cycle
|windows.txt|   commands for using multiple windows and buffers
|tabpage.txt|   commands for using multiple tab pages
|syntax.txt|    syntax highlighting
|spell.txt| spell checking
|diff.txt|  working with two to four versions of the same file
|autocmd.txt|   automatically executing commands on an event
|filetype.txt|  settings done specifically for a type of file
|eval.txt|  expression evaluation, conditional commands
|fold.txt|  hide (fold) ranges of lines

Special issues ~
|print.txt| printing
|remote.txt|    using Vim as a server or client
|term.txt|  using different terminals and mice
|digraph.txt|   list of available digraphs
|mbyte.txt| multi-byte text support
|mlang.txt| non-English language support
|arabic.txt|    Arabic language support and editing
|farsi.txt| Farsi (Persian) editing
|hebrew.txt|    Hebrew language support and editing
|russian.txt|   Russian language support and editing
|ft_ada.txt|    Ada (the programming language) support
|ft_sql.txt|    about the SQL filetype plugin
|rileft.txt|    right-to-left editing mode

GUI ~
|gui.txt|   Graphical User Interface (GUI)
|gui_w32.txt|   Win32 GUI

Interfaces ~
|if_cscop.txt|  using Cscope with Vim
|if_pyth.txt|   Python interface
|if_ruby.txt|   Ruby interface
|debugger.txt|  Interface with a debugger
|sign.txt|  debugging signs

Versions ~
|vim_diff.txt|  Main differences between Nvim and Vim
|vi_diff.txt|   Main differences between Vim and Vi
                                                *sys-file-list*
Remarks about specific systems ~
|os_win32.txt|  MS-Windows
                                                *standard-plugin-list*
Standard plugins ~
|pi_gzip.txt|      Reading and writing compressed files
|pi_netrw.txt|     Reading and writing files over a network
|pi_paren.txt|     Highlight matching parens
|pi_tar.txt|       Tar file explorer
|pi_vimball.txt|   Create a self-installing Vim script
|pi_zip.txt|       Zip archive explorer

LOCAL ADDITIONS:                *local-additions*

------------------------------------------------------------------------------
*bars*      Bars example

Now that you've jumped here with CTRL-] or a double mouse click, you can use
CTRL-T, CTRL-O, g<RightMouse>, or <C-RightMouse> to go back to where you were.

Note that tags are within | characters, but when highlighting is enabled these
characters are hidden.  That makes it easier to read a command.

Anyway, you can use CTRL-] on any word, also when it is not within |, and Vim
will try to find help for it.  Especially for options in single quotes, e.g.
'hlsearch'.

------------------------------------------------------------------------------
 vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl:
| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

Perl 5, 36 bytes (35 + 1 for -E)

$^X=~s/.+(.)(...)$/\U$1\E$2/;say$^X

Run with the -E flag.

$ perl -E 'say$^X=~s/.+(.)(...)$/\U$1\E$2/r'
Perl

The variable $^X is the path to the executable that is running the current program. Since the Perl interpreter is called perl, we then need to make he first letter upper-case. But the ucfirst function contains an r, which is not allowed, so we have to resort to \U and \E, which turn upper-case-conversion on and off.

We cannot use the /r modifier for s/// to return the changed string because the r is not allowed.

It's important to know that the name of the Perl programming language is Perl, and the name of the interpreter is perl with a lower-case p. There is no PERL.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Technically, I think perl -v satisfies the constraints of the challenge, but this is much more interesting :) Although it makes assumptions that don't hold on all systems (e.g. $^X is /home/foo/.plenv/versions/5.16.3/bin/perl5.16.3 for me, but it could just as well be /home/foo/python if I were twisted like that). \$\endgroup\$ – ThisSuitIsBlackNot Jan 25 '17 at 23:22
  • \$\begingroup\$ @this not sure if that would be within the rules. They say pick a language and do stuff. But perl -v is not anything in Perl. So I think it doesn't count. But I do think there are easier ways. About the different systems, I think we can fix it with a bit more regex magic. \$\endgroup\$ – simbabque Jan 25 '17 at 23:36
  • \$\begingroup\$ There are a bunch of zero-byte solutions already that rely on default behavior (e.g. printing of version numbers). Nothing in the rules explicitly prohibits it. But it's definitely boring and feels "cheaty." \$\endgroup\$ – ThisSuitIsBlackNot Jan 26 '17 at 0:18
  • \$\begingroup\$ Looking at the rules again, you could actually just do the uber boring perl -E'say$^X'. \$\endgroup\$ – ThisSuitIsBlackNot Jan 26 '17 at 21:50
  • 2
    \$\begingroup\$ How about -E'say`$^X -v`' ? That's indisputably a program. \$\endgroup\$ – hobbs Jan 29 '17 at 18:02
4
\$\begingroup\$

R, 10 bytes

citation()

Outputs :

To cite R in publications use:

R Core Team (2016). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.

A BibTeX entry for LaTeX users is

@Manual{,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2016},
url = {https://www.R-project.org/},
}

We have invested a lot of time and effort in creating R, please cite it when using it for data analysis. See also ‘citation("pkgname")’ for citing R packages.

Quite verbose just to have R's name to appear right ?

From @djhurio's comment on an this answer using R, version does the trick too.

| improve this answer | |
\$\endgroup\$
  • 3
    \$\begingroup\$ "The output of the programming language name is not case sensitive." So why not just "r"? Or depending on strict "You can have "junk output" before or after the name of the language." you could also just do T. \$\endgroup\$ – Billywob Jan 25 '17 at 11:00
  • 2
    \$\begingroup\$ Following on @Billywob 's comment, all that is needed to output is an r or R, so another approach is to output to STDERR via a syntax error. ) outputs Error: unexpected ')' in ")", which contains an r. \$\endgroup\$ – rturnbull Jan 25 '17 at 11:56
  • \$\begingroup\$ @Billywob I agree to your comment, as well as rturnbull's. I wrote this answer quickly earlier and should have precised that, even though it makes the code and the answer futilely long, I find it funny to output all this junk just to make "R" appears. Moreover, it's the shortest way to my knowledge to write make R write its name on purpose. \$\endgroup\$ – Frédéric Jan 25 '17 at 17:36
4
\$\begingroup\$

Perl, 2 bytes

The perl is the call to the interpreter from command line:

$ perl -M6

Outputs (for my version of Perl):

Perl v6.0.0 required--this is only v5.16.3, stopped at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

Perl, 17 bytes

80.101.114.108->_

Outputs

Can't locate object method "_" via package "Perl" (perhaps you forgot to load "Perl"?) at -e line 1.

Can be shortened to 14 bytes if PERL is acceptable:

80.69.82.76->_

All solutions make use of version strings.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ That's awesome. \$\endgroup\$ – simbabque Jan 30 '17 at 8:08
  • \$\begingroup\$ I believe this updated 2-byte solution should qualify \$\endgroup\$ – Zaid Jan 30 '17 at 8:48
  • 1
    \$\begingroup\$ This must be the shortest answer in Perl ever! \$\endgroup\$ – simbabque Jan 30 '17 at 8:49
  • \$\begingroup\$ @simbabque I'm trying to figure a way to get perl -x to spit out "No Perl script found in input" \$\endgroup\$ – Zaid Jan 30 '17 at 9:13
  • 1
    \$\begingroup\$ @Zaid perl -x -e1 \$\endgroup\$ – ThisSuitIsBlackNot Jan 30 '17 at 15:16
3
\$\begingroup\$

C 24 20 Bytes (Clang 3.8.1)

Thanks to @squeamish ossifrage for helping me save 4 bytes.

main(){putchar(67);}
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ How about putchar(67);? \$\endgroup\$ – r3mainer Jan 25 '17 at 1:36
  • \$\begingroup\$ @squeamishossifrage yep, thanks \$\endgroup\$ – Wade Tyler Jan 25 '17 at 1:40
  • \$\begingroup\$ Just curious, but wouldn't printf('c') also be valid? You're not allowed to use uppercase "C", but you are lowercase, and the result is case-insensitive. \$\endgroup\$ – Vitani Jan 25 '17 at 9:51
  • 1
    \$\begingroup\$ @Jocie printf needs a char * so I need to use "" \$\endgroup\$ – Wade Tyler Jan 25 '17 at 12:30
  • 1
    \$\begingroup\$ if result is not case sensitive, then puts("c") saves a few bytes, and does not use uppercase C... Rules might need an edit then \$\endgroup\$ – Florian Castellane Jan 26 '17 at 15:16
3
\$\begingroup\$

Jelly, 4 bytes

“Ẏṃ»

Try it online!

Jelly supports a dictionary-compressed string representation which is based off an English dictionary; every word in English (according to the dictionary) has a short compressed representation. Luckily, jelly is an English word, so it's in the dictionary. Ẏṃ is the compressed representation when the word's just by itself like this (although the representation is based on base conversion so the actual characters used depends on what other words appear in the compressed string), and “…» are the necessary delimiters to treat it as a string literal and decompress it.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Nitpick, but this outputs 'jelly' without a capital J. \$\endgroup\$ – steenbergh Jan 30 '17 at 13:18
  • 2
    \$\begingroup\$ @steenbergh The output of the programming language name is not case sensitive. \$\endgroup\$ – Mego Jan 31 '17 at 19:47
  • \$\begingroup\$ @Mego Huh, my bad. Could've sworn that it was... \$\endgroup\$ – steenbergh Jan 31 '17 at 19:53
  • \$\begingroup\$ @steenbergh: this technique works to output a capital J just as well, but it's a byte longer. Because the question allows case-insensitive output, I had to exploit that to bring the byte count down. \$\endgroup\$ – user62131 Feb 1 '17 at 0:16
3
\$\begingroup\$

Groovy, 1 byte

a

In fact, a can be replaced by any character except the ones in Groovy. This raises a MissingPropertyException and outputs the following to STDERR-

groovy.lang.MissingPropertyException: No such property: a ...
| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

Pyke, 1 byte

v

Try it here!

Outputs file path to stderr. Only guaranteed to work on online interpreter.

2 bytes

~f

Try it here!

Outputs every permutation of alphabetical characters

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ The online interpreter times out before reaching pyke (on the second solution) :( \$\endgroup\$ – devRicher Jan 25 '17 at 11:02
  • \$\begingroup\$ @devRicher I'd be surprised if it didn't. That would use far too much memory in my browser to even display that many permutations (think about 450000 lines of output) \$\endgroup\$ – Blue Jan 25 '17 at 17:18
3
\$\begingroup\$

Labyrinth, 31 28 bytes

76.65.66.89.82.73.78.84.72.@

Try it online!

Prints LABYRINTH.

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

Vim, 0 bytes

Starting Vim from the command line with no arguments yields:

~                                        VIM - Vi IMproved
~
~                                          version 8.0.92
~                                     by Bram Moolenaar et al.
~                           Vim is open source and freely distributable
~
~                                  Help poor children in Uganda!
~                          type  :help iccf<Enter>       for information
~
~                          type  :q<Enter>               to exit
~                          type  :help<Enter>  or  <F1>  for on-line help
~                          type  :help version8<Enter>   for version info
~
~
~
~
~
~
| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

Brachylog, 1 byte

e

Try it online!

Outputs to STDERR:

ERROR: Prolog initialisation failed:
ERROR: brachylog_main/3: Undefined procedure: default/0

The reason being that e, as of this version of Brachylog, is not implemented and is thus linked to no predicate name in the source code. This causes an ill-defined transpiling behavior which causes the main predicate (called brachylog_main) to contain incorrect Prolog code.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ @mbomb007 Completely forgot about that, fixed. e does the exact same thing. Thanks. \$\endgroup\$ – Fatalize Jan 25 '17 at 14:57
3
\$\begingroup\$

Befunge, 0, 1 or 19 bytes

Assuming the program doesn't need to terminate, then you can use a 0 byte file as the source, and the reference interpreter will by default will output its version header before going into an infinite loop:

Befunge-93 Interpreter/Debugger v2.23

If the program does need to terminate, then a singe byte exit command will suffice.

@

If the version header doesn't count as valid output, here's a more interesting 19 byte solution:

"kmt{lkH">0#,-:#6_@

Try it online!

The string "Befunge" has just been offset by 6 bytes to avoid using any of the characters in the name.

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

PHP (2 Byte)

a;

Run it on the console, no opening tag required. a isn't defined and the semicolon closes the statement and because it's not in a block, it gets evaluated immediately.

This will cause the following warning to be printed:

PHP Notice: Use of undefined constant a - assumed 'a' in php shell code on line 1

As you can see, it starts off with the name of the programming language.

I won't go for the really cheap way of saying that the name of the programming language is displayed on the shell, though. On the shell, it reads "php" (lowercase) and PHP is commonly written both ways. In fact, the title of http://php.net is written in all-caps, whereas the logo only contains lowercase letters. The only thing that's for sure in this regard is that people who write it as "Php", are just wrong.

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

PHP, 13 bytes

<?=phpinfo();

Returns a lot of information, including a line such as:

PHP Version => 7.0.10

Command line version, 6 bytes:

php -v

Returns something along those lines:

PHP 7.0.10 (cli) (built: Aug 18 2016 09:48:53) ( ZTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

Thanks to Martinj for suggesting this one.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Commandline php would be php -v, which is 6 :) \$\endgroup\$ – Martijn Jan 26 '17 at 15:31
  • \$\begingroup\$ @Martijn You're right. Thanks! Because we need php anyway, I wonder if it's not just 2 bytes for the -v flag... \$\endgroup\$ – Arnauld Jan 26 '17 at 15:39
  • \$\begingroup\$ You could skip the opening <?= and just print php, which in a webserver context would end up being rendered inside <body> in your browser; 3 bytes \$\endgroup\$ – Sleavely Nov 18 '19 at 14:19
3
\$\begingroup\$

COMMODORE 64 BASIC, 8 bytes

1sY64738

To get around the case-sensitive "can't use the characters of the languages's name" restriction, put the computer in "shifted mode" so you can enter the "s" in lower-case. This code performs a soft reset of the computer, taking it out of shifted mode (so the name is printed in upper-case) and printing out the name. The output printed:

    **** COMMODORE 64 BASIC V2 ****

 64 K RAM SYSTEM  38911 BASIC BYTES FREE

READY.
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ You don't require the line number here as you can execute any sys call in direct mode. \$\endgroup\$ – Shaun Bebbers Aug 13 '19 at 16:01
  • 1
    \$\begingroup\$ @ShaunBebbers, the line number is what makes it a program rather than an immediate command. \$\endgroup\$ – Mark Aug 13 '19 at 21:38
  • \$\begingroup\$ Yes you are right; If it specifically says you need it in a program or as an executable in the rules then you require the line number; if not, you have saved one PETSCII character on your submission. \$\endgroup\$ – Shaun Bebbers Aug 13 '19 at 21:46
3
\$\begingroup\$

Excel, 35

Closing parens already discounted.

Simple enough:

  • A1 - =RIGHT(0=1) - E from FALSE
  • Output - =A1&ROMAN(90)&A1&ROMAN(50) - EXCEL

ROMAN(90) = XC, ROMAN(50) = L

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Or is it 0 because of the splash screen when you start up Excel? \$\endgroup\$ – Calculuswhiz Jul 25 at 5:38
2
\$\begingroup\$

RProgN, 19 Bytes.

~(70811.911.)71.+c.

Nice and easy! This was the first time (I think) I've gotten to use Stack Constructors in a challenge!

Explanation

~(70811.911.)71.+c.
~                   # Start a Zero Space Segment
 (          )       # Push a Stack
  7                 # Literal Numbers, the . concatenates two digits to form a single number.
   0                #
    8               #
     11.            #
        9           #
         11.        #
             71.+   # Add 71 to every value in the stack.
                 c. # Convert to their char values. Although this stack is configured 'backwards', when . is called, the stack concatenation works backwards. That's just how RProgN does it.
                    # Print is implicit.

Try it online!

Boring Cheaty Way

`rpROGn

Because the text output isn't case sensitive but the characters is...

| improve this answer | |
\$\endgroup\$
  • 14
    \$\begingroup\$ The Boring Cheaty Way isn't allowed because you're using R and r. \$\endgroup\$ – flornquake Jan 25 '17 at 16:17
2
\$\begingroup\$

Python 2, 25 bytes

exec"pri\156\164'pYTHON'"

Try it online!

Prints pYTHON. Uses octal codes for the banned characters n and t.

If functions are allowed, we can just do:

lambda:"pYTHON"
| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ Very nice! Of course, I have bias towards my import this solution for the creativity factor, but you can take the shorter answer :P \$\endgroup\$ – Value Ink Jan 25 '17 at 0:44
  • \$\begingroup\$ @RaisingAgent Rule 4 says The output of the programming language name is not case sensitive. \$\endgroup\$ – user63571 Jan 25 '17 at 15:12
2
\$\begingroup\$

Python 2, 15 bytes

exec"\150elp()"

Takes part of my Python 3 answer and @xnor answer to make this

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Octave, 3 2 bytes

qz

Results in the following error message

 -- LAMBDA = qz (A, B)
 -- LAMBDA = qz (A, B, OPT)

Additional help for built-in functions and operators is
available in the online version of the manual.  Use the command
'doc <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at http://www.octave.org and via the help@octave.org
mailing list.
| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

GNU CLISP (2.49+, on Cygwin) (5 or 6 bytes)

'clisp (6 bytes)

Outputs:

CLISP

(answer based on quote usage in https://codegolf.stackexchange.com/a/89234/59547 )

If you reduce it to

clisp (5 bytes)

you can get the error

*** - SYSTEM::READ-EVAL-PRINT: variable CLISP has no value....
| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

><>, 8 bytes

f4*:2+oo

Try it online!

Prints the string >< repeatedly.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

FerNANDo, 79 bytes

3 3
1
2 2
0 3 0 0 0 2 2 1
0 3 2 0 1 3 1 2
0 3 2 2 0 1 2 0
0 3 1 0 3 3 3 1
1 1
1

Try it online!

Based on primo's technique for "Hello, World!". The idea is to loop twice through four printing commands, while using the variables 0, 1, 2, 3 for all possible combinations of the values 0/1:

variable                0  1  2  3
value on 1st iteration  0  0  1  1
value on 2nd iteration  0  1  0  1

With these, we can then encode arbitrary pairs of characters to be printed, which allows us to print four characters in each iteration. I used this CJam script to compute the printing commands (change the 4 to a different value if you want to print a different number of characters per iteration).

I also tried doing 3 iterations, like primo's answer (which would require printing a trailing linefeed), but that ends up being a few bytes longer. It might be possible to save bytes by using 4 iterations, since you need only a few of the possible byte combinations (0 2 4 7 9 12 15, specifically), but I need to take more time to figure out how to compute them efficiently.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

PHP, 2 bytes (0 bytes of code plus 2 bytes for extra command line arguments)

-i

Outputs a ton of stuff, including:

PHP Version => 7.1.1
PHP API => 20160303
PHP Extension => 20160303
PHP Extension Build => API20160303,NTS
PHP License
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ -i doesn't run a program. Not sure if this is valid \$\endgroup\$ – aross Jan 30 '17 at 9:38
  • 3
    \$\begingroup\$ <shrug> If actually running a program is a requirement then all the answers which rely on a compile error are not valid as well. :) \$\endgroup\$ – Alex Howansky Jan 30 '17 at 15:09
2
\$\begingroup\$

Bash (+ coreutils), 8 3 bytes

env

Try it online!

Output is

  .
  .
  .
SHELL=/bin/bash
  .
  .
  .
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Note that on Unix this is your login shell, not the running shell. So bash may not be listed. \$\endgroup\$ – Jakob Mar 25 '18 at 4:47
2
\$\begingroup\$

Perl 5.10+, 18 bytes

$ perl -E'/.\KIO/~~%::;say$`'
Perl

Requires Perl 5.10 or higher for say, \K, and the smartmatch operator ~~.

Per this meta answer, I'm not counting -E, although there are dissenting opinions.

How it works

The main symbol table %main:: (or %:: for short) always contains an entry for PerlIO:

$ perl -E'say $main::{"PerlIO::"}'
*main::PerlIO::

A symbol table is just a hash; you can search for keys that match a given regex using smartmatch:

$ perl -E'say "match" if /.\KIO/ ~~ %main::'
match

(There's also an entry for IO::, but it doesn't match this regex.)

\K causes the regex engine to "keep" everything matched up to that point and not add it to $&, so you end up with the text "IO" in $& and "Perl" in $`.


On newer versions of Perl, smartmatch will trigger a warning, but the output is still valid:

$ perl -E'/.\KIO/~~%::;say$`'
Smartmatch is experimental at -e line 1.
Perl

Shorter solution for Perl < 5.18

Perl 5.18.0 introduced hash randomization. Before that, functions like keys always returned hash keys and values in the same order from run to run.

On my installation of Perl 5.16.3 on Linux, the entry for PerlIO:: always appears before the entry for IO::, so I can shave off three bytes from the regex:

$ perl5.16.3 -E'/IO/~~%::;say$`'
Perl

I suspect this will work for other installations < 5.18 (I've only checked 5.16.3 and 5.8.8).

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ say%:: is good enough to meet the specs :) \$\endgroup\$ – Zaid Jan 29 '17 at 20:45
  • \$\begingroup\$ @Zaid I see you were reading my comments on simbabque's answer :) But what a stupid rule that is...filtering out extra output makes the challenge much more fun. \$\endgroup\$ – ThisSuitIsBlackNot Jan 30 '17 at 15:19
2
\$\begingroup\$

chicken (not scheme), 1 byte

The language name might also be chicken chicken, see here

a

outputs:

Error on line 1: expected 'chicken'
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Downvoter please explain. This seems perfectly valid to me \$\endgroup\$ – aross Jan 30 '17 at 9:46
2
\$\begingroup\$

Bash, 9 bytes

--verSion

Will output the following:

GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

which has the word in it.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Perhaps I'm missing something, but I only see the word bash in the command itself and not the output. I don't think that counts. \$\endgroup\$ – Digital Trauma Jan 25 '17 at 15:46
  • \$\begingroup\$ I'm pretty sure this is valid if you call it a REPL answer. When I run x from the REPL, I get the following output: DJ@DJ-PC:~$ x; bash: x: command not found; DJ@DJ-PC:~$; (Note that the semicolons are newlines) (Also note that I tested it on git-bash) \$\endgroup\$ – James Feb 15 '17 at 17:26
  • \$\begingroup\$ changed it completely now, the new version is reproducible \$\endgroup\$ – RaisingAgent Feb 21 '17 at 9:54
2
\$\begingroup\$

T-SQL - 58 Bytes

print left(char(84)+char(45)+substring(@@version,11,3),5)

Making use of the casing difference on the highlighted chars.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Python 2, 44 bytes

exec('pRINt'.upper().swapcase()+' "pYTHON"')

Try it online!

It works by taking a weirdly capitalized string and making it normal, then executing it. I originally solved this by using this method to import sys, but then I realized I could just use it with print.

| improve this answer | |
\$\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.