17
\$\begingroup\$

Challenge:

Your task is to use any language to output that language's name times the number of character's in its name.

  • Use the common name or acronym of the language.
  • If there are multiple versions of a language, you need not include the version number.
  • The capitalization matters.

Examples:

PHP -> PHPPHPPHP
Java -> JavaJavaJavaJava
C++ -> C++C++C++
Python 3 -> PythonPythonPythonPythonPythonPython
JavaScript -> JavaScriptJavaScriptJavaScriptJavaScriptJavaScriptJavaScriptJavaScriptJavaScriptJavaScriptJavaScript
\$\endgroup\$
24
  • 31
    \$\begingroup\$ Tasks that depend on a language's name are a form of disadvantaging some languages by arbitrary criteria. \$\endgroup\$ Dec 17, 2017 at 15:08
  • 18
    \$\begingroup\$ I think this challenge would have been a lot more interesting if the repetition count was supposed to be our bytecount... \$\endgroup\$
    – Maya
    Dec 17, 2017 at 16:53
  • 15
    \$\begingroup\$ And because it hasn't been said yet: Welcome to PPCG! I hope you stick around despite your probably confusing first impression of people telling you that this is not a good challenge while one answer after the other arrives. \$\endgroup\$
    – Laikoni
    Dec 17, 2017 at 21:06
  • 3
    \$\begingroup\$ @DonielF is that shortest though? \$\endgroup\$
    – Quintec
    Dec 18, 2017 at 20:09
  • 4
    \$\begingroup\$ IMO this is unclear. Use the common name suggests that, for example, JS could be used for JavaScript. But what's to stop me saying that my language "Language" is more commonly known as "L"? \$\endgroup\$
    – FlipTack
    Dec 24, 2017 at 19:25

97 Answers 97

21
\$\begingroup\$

V, 2 bytes

iV

Try it online!

Citing Arnauld, with Levenshtein distance of 1:

I now have 15 seconds of experience in V programming. So, this may actually be golfable.

\$\endgroup\$
3
  • \$\begingroup\$ 2 bytes. :P \$\endgroup\$ Dec 17, 2017 at 15:32
  • \$\begingroup\$ @totallyhuman It's indeed golfable. \$\endgroup\$
    – DELETE_ME
    Dec 17, 2017 at 15:33
  • \$\begingroup\$ Well, right language for the job! :) \$\endgroup\$
    – DJMcMayhem
    Dec 18, 2017 at 18:38
16
\$\begingroup\$

Haskell, 16 bytes

h>>h
h="Haskell"

Try it online!

Applied on two lists, (>>) concatenates the second list with itself as often as the first list has elements.


Point-free (19 bytes)

id=<<(>>)$"Haskell"

Try it online!

(id=<<) is the same as join, but without the need for import Control.Monad.

\$\endgroup\$
3
  • \$\begingroup\$ I think you will need to count the putStr as well, or at least the s= that creates the nullary function. \$\endgroup\$
    – Bergi
    Dec 19, 2017 at 6:10
  • \$\begingroup\$ @Bergi It is not needed according to the current Meta consensus on this topic, though I'd also be happy to change my answer if you have a good argument in favour of requiring a leading s=. \$\endgroup\$
    – Laikoni
    Dec 19, 2017 at 6:57
  • \$\begingroup\$ Ah, I already understood the "function" in program or function as a function declaration statement, not a function value expression. \$\endgroup\$
    – Bergi
    Dec 19, 2017 at 7:04
16
\$\begingroup\$

J, 7 bytes

I now have 15 seconds of experience in J programming. So, this may actually be golfable(1).

echo'J'

Try it online!

(1) Edit: And of course it was. Thanks to @ConorO'Brien for saving 2 bytes! Using a verb:

5 bytes

'J'"_
\$\endgroup\$
3
  • \$\begingroup\$ Your answer became the one with most citations... \$\endgroup\$
    – DELETE_ME
    Dec 17, 2017 at 15:25
  • 14
    \$\begingroup\$ @user202729 Is there a hat for that? \$\endgroup\$
    – Arnauld
    Dec 17, 2017 at 15:30
  • 2
    \$\begingroup\$ You could also make this a verb (function) (5 bytes): 'J'"_. The rank conjunction ", when it has a left-arg as a noun, it makes that noun into a constant verb returning that noun. \$\endgroup\$ Dec 17, 2017 at 19:02
15
\$\begingroup\$

4, 11 bytes

3.600525004

Explanation:

3.            Required prefix for all 4 programs.
  6            Set
   00            The cell at index 0
     52          To 52 (ASCII value for '4').
       5       Print
        00      The cell at index 0.
          4   Required suffix for all 4 programs.

Try it online!

\$\endgroup\$
1
  • 2
    \$\begingroup\$ I was just going to write that... \$\endgroup\$
    – DELETE_ME
    Dec 17, 2017 at 15:37
12
\$\begingroup\$

Operation Flashpoint scripting language, 64 bytes

f={s="%1%1%1%1";format[s+"%1",format[s,"Operation Flashpoint"]]}

Since there is no official name for the scripting language, I'm using Operation Flashpoint as the name of the language.

Call with:

hint call f

Output:

\$\endgroup\$
10
\$\begingroup\$

R, 8 bytes

cat("R")

Try it online!

\$\endgroup\$
5
  • \$\begingroup\$ I think this can be done in 7 bytes, just "R" but called with source(<program name>,ec=T) \$\endgroup\$
    – Giuseppe
    Dec 17, 2017 at 16:33
  • \$\begingroup\$ With the ec=T being like a compiler flag for +4 bytes \$\endgroup\$
    – Giuseppe
    Dec 17, 2017 at 16:33
  • \$\begingroup\$ @Giuseppe I think using RGui, RStudio, or anything else with a REPL, you can just do "R". I don't know if that counts. \$\endgroup\$
    – KSmarts
    Dec 17, 2017 at 19:14
  • \$\begingroup\$ @KSmarts outputs [1] "R" for me... \$\endgroup\$
    – Maya
    Dec 17, 2017 at 19:19
  • \$\begingroup\$ @KSmarts meta post \$\endgroup\$
    – Giuseppe
    Dec 17, 2017 at 21:33
8
\$\begingroup\$

M, 2 bytes

”M

Single-letter languages have a clear advantage.

Try it online!

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

Retina, 12 bytes


Retina
.
$_

Try it online!

Explanation


Retina

Initialise the string to Retina.

.
$_

Replace each character with the full string.

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

///, 17 bytes

/i/\\\//iiiiiiiii

Try it online!

(this prints /////////)


Naive solution is (only) 1 byte longer.

\/\/\/\/\/\/\/\/\/

Trying to remove the duplicated is actually increases byte count.

/#/iii//i/\\\//###
\$\endgroup\$
8
\$\begingroup\$

C, 12 bytes

f(x){x="C";}

Try it online! (GCC)

Saved 3 bytes with help from user202729. C has been chosen strategically, but this is pretty much GCC-specific.

\$\endgroup\$
5
  • \$\begingroup\$ How can this function be used in a program? \$\endgroup\$
    – anatolyg
    Dec 17, 2017 at 21:35
  • \$\begingroup\$ @anatolyg See the tio link. \$\endgroup\$
    – Mr. Xcoder
    Dec 17, 2017 at 21:36
  • \$\begingroup\$ Can't say that's fair considering it requires other code to actually run. \$\endgroup\$
    – Galen Nare
    Dec 18, 2017 at 3:05
  • 10
    \$\begingroup\$ @GalenNare Typically on this site, we allow function submissions. This is just a function. \$\endgroup\$ Dec 18, 2017 at 3:48
  • \$\begingroup\$ Lovely way to generate lots of warnings though :) \$\endgroup\$ Dec 19, 2017 at 20:28
8
\$\begingroup\$

Verbosity, 458 454 bytes

Include<Integer>
Include<MetaFunctions>
Include<Output>
Include<String>
Integer:DefineVariable<o; 1>
Output:DefineVariable<P; 0>
String:DefineVariable<s; "VerbosityVerbosityVerbosityVerbosityVerbosityVerbosityVerbosityVerbosityVerbosity">
String:DefineVariable<q; String:RemoveCharactersFromStart<s; o>>
String:DefineVariable<r; String:TakeFirstCharacters<q; o>>
Output:DisplayAsText<P; r>
DefineMain<> [
MetaFunctions:ExecuteScript<MetaFunctions@FILE>
]

Try it online!

Saved 4 bytes thanks to NieDzejkob!

You know your language is verbose when it's shorter to create an 81 character long string that it is to multiply a 9 character long string by 9.

\$\endgroup\$
2
  • \$\begingroup\$ 454 bytes \$\endgroup\$
    – Maya
    Dec 17, 2017 at 15:43
  • \$\begingroup\$ @NieDzejkob Nice! That's quite clever! \$\endgroup\$ Dec 17, 2017 at 15:57
7
\$\begingroup\$

Chef, 268 bytes

C.

Ingredients.
102 l f
101 l e
104 l h
67 l c
4 g i

Method.
Put f into the mixing bowl.
Put e into the mixing bowl.
Put h into the mixing bowl.
Put c into the mixing bowl.
V the i.
Pour contents of the mixing bowl into the baking dish.
V the i until ved.

Serves 1.

Try it online!

More idiomatic (565 bytes):

PPCG Holiday Punch.

Ingredients.
408 ml apple cider
404 ml ginger beer
416 ml champagne
67 ml unsweetened cranberry juice
4 pinches mixed spice

Method.
Put apple cider into the mixing bowl.
Divide mixed spice into the mixing bowl.
Put ginger beer into the mixing bowl.
Divide mixed spice into the mixing bowl.
Put champagne into the mixing bowl.
Divide mixed spice into the mixing bowl.
Put unsweetened cranberry juice into the mixing bowl.
Sift the mixed spice.
Pour contents of the mixing bowl into the baking dish.
Sift the mixed spice until sifted.

Serves 5.

Try it online!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Now that is a neat language. \$\endgroup\$
    – adrian
    Dec 17, 2017 at 21:40
6
\$\begingroup\$

ArnoldC, 107 bytes

IT'S SHOWTIME
TALK TO THE HAND "ArnoldCArnoldCArnoldCArnoldCArnoldCArnoldCArnoldC"
YOU HAVE BEEN TERMINATED

Try it online!

\$\endgroup\$
5
\$\begingroup\$

Python 3, 17 bytes

print("Python"*6)

Try it online!

Of course, Python 2 is 2 bytes shorter with

print"Python"*6

Try it online!

But I prefer Python 3

\$\endgroup\$
7
  • 1
    \$\begingroup\$ You know you could have used Python 2... \$\endgroup\$
    – Mr. Xcoder
    Dec 17, 2017 at 14:53
  • \$\begingroup\$ @Mr.Xcoder Edited in, but I prefer Python 3 \$\endgroup\$ Dec 17, 2017 at 14:56
  • \$\begingroup\$ Everybody does, but Python 2 is almost always golfier. :P \$\endgroup\$ Dec 17, 2017 at 15:10
  • 1
    \$\begingroup\$ @totallyhuman s/almost/almost\{when manipulating sets and lists}/ :P \$\endgroup\$
    – Mr. Xcoder
    Dec 17, 2017 at 15:12
  • \$\begingroup\$ @Mr.Xcoder You missed a terminating /? \$\endgroup\$
    – DELETE_ME
    Dec 17, 2017 at 15:17
5
\$\begingroup\$

Whispers, 36 bytes

> "Whispers"
> 8
>> 1×2
>> Output 3

Try it online!

Trivial question, trivial answers.

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

,,,, 6 bytes

',9i×

Try it online!

Hehe...

\$\endgroup\$
5
\$\begingroup\$

7, 3 bytes

31317403

Try it online!

Format similar to Hello World program, except output mode is 3 (Byte-per-three-commands). The three commands 131 encodes value 131 base 6 = 37 base 16 = character 7. Then 3 prints the character.

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

Starry, 146 bytes

        + +*`        + +  * +  *       +* .                + +  * +          + * + .       + * +          + +* +  *        + * . . . .      + * +'

Try it online!

It looks prettier with decoration, though (180 bytes):

        + +*`        
+ + /| * +  *       +
* .| \__             
  + \__/+  * +__     
     + * + . /  \    
+ * +      ========  
  + +* +  *  \__/    
  + * . . . .      + 
* +'

Try it online!

\$\endgroup\$
5
\$\begingroup\$

><>,  23 19 15 13  12 bytes

"><>" |o<.0l

Try it online!

Emigna saved 4 bytes. Not a tree saved another 3. Teal pelican managed to save 1 more byte. Thanks to all who have helped golfing! Citing Arnauld, with slight modifications: I now have 15 seconds of experience in ><> programming. So, this may actually be golfable.

\$\endgroup\$
8
  • 1
    \$\begingroup\$ "><>><>><>"oa0. \$\endgroup\$
    – Emigna
    Dec 17, 2017 at 15:18
  • 2
    \$\begingroup\$ 13 bytes: "><>"|o<"><>" \$\endgroup\$
    – Not a tree
    Dec 17, 2017 at 18:59
  • 3
    \$\begingroup\$ After having a play around using both Emigna and Notatree's changes and mixing both you can reduce this a further 1 byte: "><>" |o<.0l \$\endgroup\$ Dec 18, 2017 at 15:23
  • 2
    \$\begingroup\$ @Tealpelican: That is ingenious! \$\endgroup\$
    – Emigna
    Dec 21, 2017 at 14:48
  • 1
    \$\begingroup\$ @Tealpelican Thank you! \$\endgroup\$
    – Mr. Xcoder
    Dec 21, 2017 at 14:50
4
\$\begingroup\$

Commentator, 316 bytes

           {-     {-    -}!  {-{- e#-}//{-#-}-}! {-       
;{-
     {-   -}!!  -}////{-#{-#-}    {-     -}!-}//-}//e#   e#-}//     -}//-}//{-e#                   e#-}-}//e#      e#-}//-}//-}//-}//e#         e#{-e# e#{-e# e#{-e#         e#-}-}-}-}-}
;{-/*{-/*{-/*{-/*{-/*{-/*{-/*{-/*{-/*{-/*{-/*-}-}-}-}-}-}-}-}-}-}-}

Try it online!

Not quite as long as my Verbosity answer, but getting there

\$\endgroup\$
3
\$\begingroup\$

MSM, 9 bytes

..;;..MSM

Stack trace:

. . ; ; . . M S M             -- concat
  . ; ; . . M MS              -- concat
    ; ; . . MSM               -- dup
      ; . . MSM MSM           -- dup
        . . MSM MSM MSM       -- concat
          . MSM MSMMSM        -- concat
            MSMMSMMSM
\$\endgroup\$
3
\$\begingroup\$

D, 20 bytes

auto f(){return"D";}

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ One letter language names for the win. \$\endgroup\$
    – Adalynn
    Dec 17, 2017 at 16:08
3
\$\begingroup\$

I, 3 bytes

"I"

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ Haha I got ninja'd \$\endgroup\$
    – Giuseppe
    Dec 17, 2017 at 16:28
3
\$\begingroup\$

Emoji, 33 bytes

💬Emoji💬💬6💬📥👪➡

Abuses the type system. A lot. May not work on other interpreters than the Python one. It probably won't.

Try it online!

\$\endgroup\$
3
\$\begingroup\$

Aceto, 16 bytes

o"pp
tkpp
ecp
"A

Try it online!

\$\endgroup\$
3
\$\begingroup\$

Funky, 16 bytes

print("Funky"*5)

Try it online!

\$\endgroup\$
3
\$\begingroup\$

05AB1E, 9 bytes

•äƵí•h6×R

Try it online!


0xE1BA50, encoded in base 255, decoded into hexadecimal, repeated 6 times, reversed.

\$\endgroup\$
2
\$\begingroup\$

Japt, 8 7 bytes

4ç"Japt

Try it

\$\endgroup\$
2
\$\begingroup\$

K, 9 bytes

\echo "K"

Try it online!

\$\endgroup\$
2
\$\begingroup\$

uBASIC, 27 bytes

1FORI=1TO6:?"uBASIC";:NEXTI

This answer is pretty small, thanks to uBASIC's tokenizer being powered with a solution of magic in unicorn blood.

Try it online!

\$\endgroup\$

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