523
\$\begingroup\$

So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with , and counting). While this is not the most interesting code golf in the common languages, finding the shortest solution in certain esolangs can be a serious challenge. For instance, to my knowledge it is not known whether the shortest possible Brainfuck solution has been found yet.

Furthermore, while all of Wikipedia (the Wikipedia entry has been deleted but there is a copy at archive.org ), esolangs and Rosetta Code have lists of "Hello, World!" programs, none of these are interested in having the shortest for each language (there is also this GitHub repository). If we want to be a significant site in the code golf community, I think we should try and create the ultimate catalogue of shortest "Hello, World!" programs (similar to how our basic quine challenge contains some of the shortest known quines in various languages). So let's do this!

The Rules

  • Each submission must be a full program.

  • The program must take no input, and print Hello, World! to STDOUT (this exact byte stream, including capitalization and punctuation) plus an optional trailing newline, and nothing else.

  • The program must not write anything to STDERR.

  • If anyone wants to abuse this by creating a language where the empty program prints Hello, World!, then congrats, they just paved the way for a very boring answer.

    Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

  • Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.

  • This is not about finding the language with the shortest "Hello, World!" program. This is about finding the shortest "Hello, World!" program in every language. Therefore, I will not mark any answer as "accepted".

  • If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf - these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the authors actually had to put effort into golfing the code.

For inspiration, check the Hello World Collection.

The Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

## Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

## Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the snippet:

## [><>](https://esolangs.org/wiki/Fish), 121 bytes

/* Configuration */

var QUESTION_ID = 55422; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}

getAnswers();

var SCORE_REG = (function(){
  var headerTag     = String.raw `h\d`
  var score         = String.raw `\-?\d+\.?\d*` // with negative/floating-point support
  var normalText    = String.raw `[^\n<>]*` // no HTML tag, no newline
  var strikethrough = String.raw `<s>${normalText}</s>|<strike>${normalText}</strike>|<del>${normalText}</del>`
  var noDigitText   = String.raw `[^\n\d<>]*`
  var htmlTag       = String.raw `<[^\n<>]+>`

  return new RegExp(
  String.raw  `<${headerTag}>`+
  String.raw    `\s*([^\n,]*[^\s,]),.*?`+
  String.raw    `(${score})`+
  String.raw    `(?=`+
  String.raw      `${noDigitText}`+
  String.raw      `(?:(?:${strikethrough}|${htmlTag})${noDigitText})*`+
  String.raw      `</${headerTag}>`+
  String.raw    `)`
  );
})();

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery('<i>' + a.language + '</i>').text().toLowerCase();
    
    languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link, uniq: lang};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.uniq > b.uniq) return 1;
    if (a.uniq < b.uniq) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#answer-list {
  padding: 10px;
  float: left;
}

#language-list {
  padding: 10px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/primary.css?v=f52df912b654">
<div id="language-list">
  <h2>Winners by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>

<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr>
  </tbody>
</table>

\$\endgroup\$
22
  • 4
    \$\begingroup\$ @isaacg No it doesn't. I think there would be some interesting languages where it's not obvious whether primality testing is possible. \$\endgroup\$ Commented Aug 28, 2015 at 13:56
  • 7
    \$\begingroup\$ If the same program, such as "Hello, World!", is the shortest in many different and unrelated languages, should it be posted separately? \$\endgroup\$ Commented Aug 28, 2015 at 15:33
  • 2
    \$\begingroup\$ @mbomb007 Well it's hidden by default because the three code blocks take up a lot of space. I could minify them so that they are a single line each, but I'd rather keep the code maintainable in case bugs come up. \$\endgroup\$ Commented Aug 28, 2015 at 19:34
  • 8
    \$\begingroup\$ @ETHproductions "Unlike our usual rules, feel free to use a language (or language version) even if it's newer than this challenge." Publishing the language and an implementation before posting it would definitely be helpful though. \$\endgroup\$ Commented Aug 29, 2015 at 23:01
  • 2
    \$\begingroup\$ @MartinEnder ... Almost. If two BF solutions have the same size, the one with smaller lexicographical order will take smaller number of bytes in Unary. Of course the smallest Unary solution translated to BF is guaranteed to be smallest. \$\endgroup\$
    – user202729
    Commented May 20, 2018 at 10:20

1002 Answers 1002

1
3 4
5
6 7
34
7
\$\begingroup\$

if(j)invert()if(l)change()if(q)input()if(t)output(x);, 13 bytes

Hello, World!

Breaks the scoreboard. Any non-instruction characters are printed verbatim.

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

MATL, 15 bytes

'Hello, World!'

A string literal is pushed onto the stack. It gets implicitly printed at the end of the program.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Is it finished? Congratz! Looking forward to seeing it in use. I'll hopefully have the chance to check it out one day :-) \$\endgroup\$ Commented Dec 12, 2015 at 17:09
  • 1
    \$\begingroup\$ @StewieGriffin Not sure if it's "finished"... let's just say "stable enough". It's in version 1.0.0. But yes, it's an official version now. Being an experienced Matlab user, I hope you'll find it interesting! \$\endgroup\$
    – Luis Mendo
    Commented Dec 12, 2015 at 17:13
7
\$\begingroup\$

Glava 1.4, 16 bytes

Edit: from Doorknob's and ConorO'Brien's suggestions, the name has changed to Glava.

p("Hello, World!

Glava is a golfing Java dialect (obviously). It adds shorthands to many keywords and common phrases in Java code. So, the code above actually corresponds to the Java code:

System.out.print("Hello World!")

You may be wondering, where does the ") come from? Well, Glava has a feature where it automatically adds closing brackets and double quotes. Also, when a closing curly bracket is needed, it places a semicolon before it.

Another neat feature is that if you do not specify a main class or method, it will do it for you. So the compiled code in the end looks like:

public class Main {public static void main (String[] A) { System.out.print("Hello World!");}}
\$\endgroup\$
4
  • 1
    \$\begingroup\$ FREAKING FINALLY! Suggestion: Add a piece of code that completes quotes, parens, and } <-- those so you can omit the last four chars. (Maybe a little AIS could help here?) \$\endgroup\$ Commented Jan 3, 2016 at 17:46
  • \$\begingroup\$ Java for golf, but there's STILL a freakin' semicolon! \$\endgroup\$
    – cat
    Commented Jan 3, 2016 at 18:21
  • \$\begingroup\$ @cat yeah, I know. Me and Conor are trying to figure out how to avoid having to use it. \$\endgroup\$
    – GamrCorps
    Commented Jan 3, 2016 at 18:22
  • 3
    \$\begingroup\$ @cat well, Glava 1.2+ supports semicolon insertion before closing curly brackets, so it fixes that problem \$\endgroup\$
    – GamrCorps
    Commented Jan 4, 2016 at 16:38
7
\$\begingroup\$

beeswax, 15 bytes

Finally the first esolang I created is ready for use. I started working on beeswax as an esolang on a hexagonal grid parallel to Martin Büttner’s Hexagony, but he got finished his well before my language, as it took me quite a while to get everything right. So, here is the second esolang working on a hexagonal grid. ;)

A short hello world program is rather unspectacular, as the ` character toggles output to STDOUT.

So, here are the two short, but boring versions:

_`Hello, World!

or

*`Hello, World!

Or slightly less boring:

!dlroW ,olleH`*

_ creates instruction pointers in the horizontal axis, one moving to the right, one moving to the left.

* creates instruction pointers in all main axes, like demonstrated below.

A little more interesting, but 1 byte longer:

!lo olH`_`el,Wrd

And finally, an even more interesting version, if that’s possible:

r  l
 l o
  ``
ol`*`,d!
   ``
   e H
   W

And the same, using the beeswax prettyprint tool:

      r     l
       l   o
        ` `
   o l ` * ` , d !
        ` `
       e   H
      W

Both of which work because IPs execute their instructions in the reverse order they were created/pushed on the IP stack.

The neighborhood of every cell in a program (named honeycomb) looks like shown below. β marks a bee (instruction pointer), the numbers show the directions of the surrounding cells.

  2 — 1
 / \ / \
3 — β — 0
 \ / \ /
  4 — 5

This would be rather like a beautified version of the actual code, which is stored in a rectangular format like

21
3β0
 45

Each bee carries a stack with a fixed length of 3 values around (which isn’t used in the examples above), but they can push values on a global stack of unlimited size, or take values from it, for handling larger amounts of data. The global stack can only do basic stack operations like rotating values up and down. Only bees can do more complex operations like arithmetics or logic operations. All values are 64 bit unsigned integers.

Bees can also drop values to any place on the honeycomb and change its size or modify the source code this way, or they can pick up values from any place on the honeycomb. The contents of the global stack can be written to files, or file contents can be stored in the global stack.

More info, the full specification, an interpreter (with very basic debugging abilities) written in Julia, examples etc. can be cloned from my github page. Pretty much the same information is also available on the esolangs.org beeswax page.

\$\endgroup\$
7
\$\begingroup\$

Sesos, 24 21 bytes

0000000: 2845ee adaa55 ddcabd 123596 b32b71 5f398a 23b577  (E...U....5..+q_9.#.w

Try it online! Check Debug to see the generated binary code.

I tried several less straightforward approaches – including a port of @primo's brainfuck answer – but they all turned out longer.

How it works

The binary file above has been generated by assembling the following SASM code.

add 72  ; Set cell 0 to 72.
put     ; Print 'H'.
fwd 1   ; Advance to cell 1.
add 101 ; Set cell 1 to 101.
put     ; Print 'e'.
add 7   ; Set cell 1 to 108.
put     ; Print 'l'.
put     ; Print 'l'.
add 3   ; Set cell 1 to 111.
put     ; Print 'o'.
fwd 1   ; Advance to cell 2.
add 44  ; Set cell 2 to 44.
put     ; Print ','.
sub 12  ; Set cell 2 to 32.
put     ; Print ' '.
rwd 2   ; Retrocede to cell 0.
add 15  ; Set cell 0 to 87.
put     ; Print 'W'.
fwd 1   ; Advance to cell 1.
put     ; Print 'o'.
add 3   ; Set cell 1 to 114.
put     ; Print 'r'.
sub 6   ; Set cell 1 to 108.
put     ; Print 'l'.
sub 8   ; Set cell 1 to 100.
put     ; Print 'd'.
fwd 1   ; Advance to cell 2.
add 1   ; Set cell 2 to 33.
put     ; Print '!'.
\$\endgroup\$
2
  • \$\begingroup\$ How does this end up being shorter than the trivial solution when assembled? codegolf.stackexchange.com/a/86567/34718 \$\endgroup\$
    – mbomb007
    Commented Jul 25, 2016 at 19:39
  • \$\begingroup\$ Because the arguments to add and sub are considerably smaller. Arguments are encoded in bijective binary, and each digit requires 3 bits. \$\endgroup\$
    – Dennis
    Commented Jul 25, 2016 at 19:42
7
\$\begingroup\$

Brian & Chuck, 42 38 32 bytes

_#Jgnnq."Yqtnf#_{?
#{<{>-?>--.>?

Try it online!

Introducing my latest esolang, originally submitted for Create a programming language that only appears to be unusable.

Each of the two lines defines a Brainfuck-like program which operates on the other program's source code - the first program is called Brian and the second is called Chuck. That makes "Hello, World!" about as simple as it is in Self-modifying Brainfuck (compared to Brainfuck itself).

I said that looping was too expensive in B&C to be worthwhile for a simple "Hello, World!", but it turns out I was wrong. Now I'm much less convinced that the code is optimal as it stands...

Explanation

One note about the source code: when parsing it, the interpreter replaces all _ with null bytes to make it easier to insert zero cells into the tapes.

Notice that Jgnnq."Yqtnf# is Hello, World! shifted by two characters. Why is it shifted? Because the , in Hello, World! is a valid command which would set a cell on Chuck to -1. We could shift it by one character (either way), but then the , would turn into either + or - which are also valid commands. We could reverse those at the end of Brian but the code as above has the same byte count and it seems a bit neater: we shift them by two characters, such that . becomes , which is a no-op for Brian.

So, when the program begins, Brian ignores everything on the tape until {? which switches control to Chuck, starting on the second command.

{<{> on Chuck finds the first non-zero cell on Brian (initially the #, which is just a dummy no-op). We decrement it with -. If that didn't make the cell zero yet, ? switches control back to Brian. Brian again ignores all the "code" in Jgnnq."Ypynf#_ and resets the loop on Chuck with {?.

Once that first cell has been zeroed, ? is a no-op. >--. moves to the next cell, subtracts 2 (to correct the offset) and prints it. Then we check if there's another character left to print by moving one to the right with >. If this reaches the null byte after the string (the _ on Brian's tape), then ? is a no-op and the program terminates. If that isn't a null byte yet, we've got more printing to do, and start over by switching to Brian who resets the loop with {? once more.

\$\endgroup\$
1
  • 3
    \$\begingroup\$ Congratulations on posting the 300th answer to this question. [insert_celebrate_emoticon_here] \$\endgroup\$
    – manatwork
    Commented Nov 6, 2015 at 14:31
7
\$\begingroup\$

Haskell, 26 bytes

main=putStr"Hello, World!"

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ Putting one of the many compilers you downloaded for PLQ to good use I see. ;) \$\endgroup\$
    – Alex A.
    Commented Aug 28, 2015 at 16:52
7
\$\begingroup\$

Retina, 14 bytes


Hello, World!

Try it online!

A program with two lines describes a single regex replacement. Here, we just replace the empty string (i.e. the input) with the desired output.

For one additional byte, we can make it work with non-empty input, by using a constant stage:

K`Hello, World!

Try it online!

\$\endgroup\$
7
\$\begingroup\$

Folders (pure), 195 folders

Some languages, like Folders, are a bit tricky to score

I'm not sure how it translates to bytes, but we can just count the number of folders: (src)

$ ls -l -R . | grep -c ^d
195
$ ls -l -R . | grep :$
./New folder:
./New folder/New folder:
./New folder/New folder/New folder:
./New folder/New folder/New folder (2):
./New folder/New folder/New folder (3):
./New folder/New folder/New folder (4):
./New folder/New folder (2):
./New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder/New folder (2):
./New folder/New folder (2)/New folder/New folder (3):
./New folder/New folder (2)/New folder/New folder (4):
./New folder/New folder (2)/New folder/New folder (5):
./New folder/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2)/New folder (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (11):
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (12):
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder/New folder (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9):
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder (2)/New folder (2):

Folders (concise), 2 folders + (5 + 13) bytes

./Setup
./Setup/Hello, World!
\$\endgroup\$
6
  • 1
    \$\begingroup\$ Welcome to PPCG! / Using inline code formatting can be quite hard to read, I edited the answer. \$\endgroup\$
    – user202729
    Commented Feb 2, 2018 at 10:29
  • \$\begingroup\$ Does this include the comma? I don't see one in your concise version but I don't have a folders installation to check. \$\endgroup\$
    – Potato44
    Commented Feb 6, 2018 at 22:21
  • \$\begingroup\$ According to the original site, (and by the number of folders) it is with the comma. I fixed my concise example. \$\endgroup\$
    – Eran W
    Commented Feb 7, 2018 at 0:44
  • 1
    \$\begingroup\$ Easier way to count: find * -type f | wc -l (counts lines of output) \$\endgroup\$ Commented Apr 13, 2018 at 2:57
  • \$\begingroup\$ Right, It is shorter by one character... But I could use -lR \$\endgroup\$
    – Eran W
    Commented Apr 14, 2018 at 8:21
7
\$\begingroup\$

Mind, 26 bytes

The program is encoded in Shift_JIS:

メインは
"Hello, World!"
表示

It means something like:

MAIN is:
"Hello, World!"
display

As you can see, Mind is a Japanese programming language. It's based on Forth, which turns out to suit Japanese's SOV word order rather well!

\$\endgroup\$
7
+250
\$\begingroup\$

Grass, 463 446 bytes

It exits with a crash. Append vw to get a non-crashing version (448 bytes).

wWWWwWWWWwWWWWWwvwwWWwWWWwvWwWwwwwwWWWwWWWwWWWWWwvwWWwwwwwwwwwwwWWWwWWWWWwWWWWwvwWWwwwwwWWWWWWWWWWWWwWWWwvWwwwwwwwwwwwWWwwwwwwWWWWWWWWwWWWWWWWwwWWWWWWwwwwwwwvwWWWWWWWwwwwwwwwwWWWWWWWWWWWWWwWWWwvWwwwwwwwwwwwwwwwwwWWwwwwwwwwwwwwWWWWWWWWWWWWWWWWWwvwWwWwwwwwwwwWwwwwwwWwwwwwwWwwwwwwwWwwwwwwwWwwwwwwwwwwwwwwWWWWWWWWWWWWWWWWWWwvwwWWWWWWWWWWWWWWWWWWWWWWwWWWwwwvWWwWWWWWWWWWWWWWWWWWWWWWwwwwWWwwwwwwwwwWwwwwwwWwwwWwwwwwwwwwWWWWWWWWWWWWwWwwwwwwwwwwwwwwwwww

Try it online!

Based on the TIO example. I think it was from this page by rst76 (613 bytes with lowercase w).

wWWWwWWWWwWWWWWwv                      x -> x + 3
wwWWwWWWwv                             f -> apply f twice (Church numeral 2)
Ww                                     f -> apply f 2**2 = 4 times
Wwwwww                                 x -> x + 4
WWWw                                   x -> x + 8
WWWw                                   x -> x + 32
WWWWWw                                 x -> x + 64
vwWWwwwwwwwwwwwWWWwWWWWWwWWWWw         f -> f(u+2 + 64 + 64 + 32) = f(23)
vwWWwwwwwWWWWWWWWWWWWwWWWwv            f -> f(23 + 8 + 1) = f(32 space)
Wwwwwwwwwwww                           (f->f(32))(x->x+1) = 33 !
WWwwwwww                               (f->f(32))(x->x+8) = 40
WWWWWWWWw                              40 + 4 = 44 ,
WWWWWWWww                              40 + 32 = 72 H
WWWWWWwwwwwww                          (f->f(23))(x->x+64) = 87 U+2
vwWWWWWWWwwwwwwwwwWWWWWWWWWWWWWwWWWwv  f -> f(32 + 64 + 4) = f(100 d)
Wwwwwwwwwwwwwwwwww                     (f->f(100)(x->x+1) = 101 e
WWwwwwwwwwwwww                         (f->f(100)(x->x+8) = 108 l
WWWWWWWWWWWWWWWWWw                     108 + 3 = 111 o
vw                                     begin function
Ww                                       c -> print c; return this function
Wwwwwwwww                                print H
Wwwwwww                                  print e
Wwwwwww                                  print l
Wwwwwwww                                 print l
Wwwwwwww                                 print o
Wwwwwwwwwwwwwww                          print ,
WWWWWWWWWWWWWWWWWWw                      print space
vwwWWWWWWWWWWWWWWWWWWWWWWwWWWwwwv      f = f -> c -> print c; return f(f)
                                       f(f) will return itself as a quine.
WWw                                    Apply the first half of output with
                                         the previous function as argument.
WWWWWWWWWWWWWWWWWWWWWwwww              111 + 3 = 114 r
WWwwwwwwwww                            print U+2
Wwwwwww                                print o
Wwww                                   print r
Wwwwwwwwww                             print l
WWWWWWWWWWWWw                          print d
Wwwwwwwwwwwwwwwwwww                    print !

Generator based on ASCII-only's (too long to post in a comment).

\$\endgroup\$
4
  • \$\begingroup\$ :| explanation pls \$\endgroup\$
    – ASCII-only
    Commented Apr 28, 2018 at 2:39
  • \$\begingroup\$ Or even better, convert to this form if you don't mind \$\endgroup\$
    – ASCII-only
    Commented Apr 28, 2018 at 2:43
  • \$\begingroup\$ @ASCII-only Added the link to answer. Not sure it is actually better. \$\endgroup\$
    – jimmy23013
    Commented Apr 28, 2018 at 5:14
  • \$\begingroup\$ Probably not, I just wanted it to add to RosetTIO to make it easier for other people to attempt to golf it (not that anyone will :P) \$\endgroup\$
    – ASCII-only
    Commented Apr 28, 2018 at 6:12
7
\$\begingroup\$

Pepe, 122 120 bytes

Pepe is my brand new programming language, which is horrible.

reeEeeEeeereeEEeeEeErEeEEeEEeereeereeeREeEEeEEEEReeereeeEeEEeereeeEeeeeereeEeEeEEEReeereeEEEeeEereeereeEEeeEeereeeEeeeeE

Try it online!

There might be shorter solutions, but that's not task for my brain .-.

That's why I'd offer a 50 100 bounty to anyone who can make it shorter, if it's possible. I don't really believe it is, but maybe you can change my mind?

This solution is quite simple, but better to explain it ungolfed and commented:

reeEeeEeee   # H > print H
reeEEeeEeE   # e > print e
rEeEEeEEee   # l > push l to r
reee reee    #     print it twice
REeEEeEEEE   # o > push o to R
Reee         #     print it
reeeEeEEee   # , > print ,
reeeEeeeee   #   > print a space
reeEeEeEEE   # W > print W
Reee         # o > print active value in R (o)
reeEEEeeEe   # r > print r
reee         # l > print active value in r (l)
reeEEeeEee   # d > print d
reeeEeeeeE   # ! > print !

The first line prints Hello, and a space, the second prints World!. Most of this program are character functions, ex. reeEeeEeee which prints H. By letter:

  • r - Stack r
  • e - Print
  • eEeeEeee - 01001000 (72), the ASCII character for H

As said, most of the program consists of similar commands, but, to golf it a bit, in first occurrence of l, I replaced the first e with E, so instead of printing, it pushed the charcode to the stack. Thanks to this, we can later print l using reee, the command for printing. Edit: Now, I've done the same with o, thanks to the existence of the second stack (notice the R letter).

\$\endgroup\$
7
\$\begingroup\$

C++ (gcc), 40 bytes

main(){__builtin_puts("Hello, World!");}

Try it online!

Using builtins are shorter since #include takes up a lot of bytes. I believe this solution is optimal.

\$\endgroup\$
1
  • \$\begingroup\$ "Optimal?" A bold claim. Ken Thompson: "Last year I taught at University of Sydney I gave that to my class, the shortest self-reproducing program in C, and I got a surprise. I didn't think there was a surprise there to be had. But, I got somebody who has the shortest one I've ever seen, which is a record breaker, by about four characters of what I had proved to myself was the shortest program, and they did it by a totally different mechanism which of course nullified the proof." princeton.edu/~hos/mike/transcripts/thompson.htm \$\endgroup\$
    – roblogic
    Commented Aug 27, 2019 at 1:53
7
\$\begingroup\$

evil, 62 58 bytes

no I haven't read through the over 500 other answers to make sure I'm adding something new
Found via computer search within a restricted subset of evil.

aeeaeayekeulaaaweevuewpuuuwwlweaaewguwuewpaaawaaawpweeawgw

Uses the instructions:

a increment the accumulator
u decrement the accumulator
z accumulator = 0
e weave operator (bitwise 01234567 to 20416375 on the accumulator)
w write character
k set the first pental cell to the accumulator
g set the accumulator to the first pental cell
v swap the accumulator and the first pental cell
y set the first wheel cell to the accumulator
l set the accumulator to the first wheel cell
p swap the accumulator and the first wheel cell

The pental is a thingy that stores 5 bytes and can be rotated; I don't rotate it though. The wheel is a circular list that starts at 1 element; I don't add/remove to/from it.

Try it online!

\$\endgroup\$
7
\$\begingroup\$

Brainetry, 651 bytes

This is a boring golf of the program that comes after this one.

a b c d
a b c d e f g h
a b c d e
a b c d e
a b
a b c d e
a b c d e f g h
a b
a b
a b c d
a b
a b c d e
a b c d e
a b c d e
a b c d e
a b c d e
a b c
a b c
a b c d e f g h i
a b c
a b c d e
a b c d e
a b c
a b c d e
a b c d e
a b c d e
a b c d e f g h i
a b
a b c d e
a b c d e f g
a b
a b
a b
a b c d
a b c d e f g
a b
a b
a b c d e f g
a b c d e f g
a b c d
a b c d
a b c d
a b c d e f g h
a b c d e f g
a b
a b c d e f g h i
a b c
a b c
a b c
a b c
a b c d e f g
a b c d
a b c d
a b c d
a b c d e f g
a b c d e
a b c d e
a b c d e
a b c d e
a b c d e
a b c d e
a b c d e f g
a b c
a b c
a b c d e
a b c d e f g
a b
a b
a b
a b
a b c d
a b c d e f g

Ungolfed but far more interesting to read:

This is a "short"
brainetry program that outputs, to stdout, the message
"Hello, World!" as per the
programming world standard. This standard
dictates that
a user that is trying
a language for the first time should write
as its
first program
this "Hello, World!" program.
Of course,
this becomes a repetitive task,
this becomes a repetitive task,
this becomes a repetitive task,
this becomes a repetitive task,
this becomes a repetitive task,
but that shouldn't
hinder you from
tackling this awesome challenge in the Brainetry programming language.
Me, myself and
I have found this language
to be quite amusing if
used to write
self-referential programs like this one.
Self-referential objects are objects that
I, personally, really enjoy. This
might be because I am just a weird person.
Or not!
Who knows? Certainly not me.
Dear reader, please rest assured that we
are ALMOST
at the
MIDDLE of
this self referential program.
Also, please refraing from adding the hyphen
between self
and referential
in the line above, as it is
NOT a typo, it is missing purposefully.
A very important skill
needed to write Brainetry
programs is one's imagination.
This is because each instruction needs one line
of Brainetry source code on its own.
Sounds easy?
I can assure you, it definitely is not easy.
I'm growing tired,
I'm growing unimaginative,
I'm growing old,
I'm writing code.
Oh boy, I wish that would've rhymed!
Even though I can't
really rhyme in English
because I am unskilled,
I can tell you that this is
exhibiting signs of schizophrenia, right?
At this point I am
pretty much talking to myself,
and no one is listening,
right? No one is listening,
right? I definitely hope not.
Now on to some decent source code,
this program works
by harnessing the
well known power of modular
arithmetic, a really nice thing mathematics has
bestowed upon
us, mortals.
This is,
for real,
a really awesome gift
from the mathematicians of yor to us.

Builds on top of this awesome brainfuck answer.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ This feels like it isn't a serious contender, since the language only appears to care about the number of words in a line, and there are a lot of words with many more letters than necessary in them. \$\endgroup\$ Commented Jun 10, 2020 at 22:53
  • \$\begingroup\$ @pppery you are, of course, right. I golfed it and included both the golfed and verbose versions. The verbose version is MUCH funnier to read :) \$\endgroup\$
    – RGS
    Commented Jun 11, 2020 at 12:07
  • \$\begingroup\$ I don't disagree, but I've chosen to focus my energy on objective rule enforcement over reading funny answers. \$\endgroup\$ Commented Jun 12, 2020 at 1:37
  • 1
    \$\begingroup\$ @pppery yes, thank you for your objectivity :) \$\endgroup\$
    – RGS
    Commented Jun 12, 2020 at 6:26
  • 2
    \$\begingroup\$ @pppery I have just seen your profile again and I find the seemingly-new sentence "But I cannot be dissuaded -- I will keep on hunting for old invalid answers and close-voting questions like I've always done." even more worrying than everything I have ever seen there so far... \$\endgroup\$ Commented Jun 12, 2020 at 11:57
7
\$\begingroup\$

PowerShell, 15 Bytes

Likely in Foo (among others) as well, but I'll let someone with more knowledge of those languages post.

"Hello, World!"

or, alternatively,

'Hello, World!'

In PowerShell, both ' and " denote string literals. The difference is the double-quotes will expand variables (e.g., $myString) and escape characters (e.g., `n), while the single-quote will treat everything literally.

PowerShell does an implicit Write of anything that's on a line by itself in a program (the relative merits of Write-Host vs Write-Output are left as an exercise to the reader) -- variable, literal string (as this is), result of a one-line command, etc. This stems from the fact that every line gets executed, and the way to execute a string is to print it. For other data types, if they have a way to convert to a string, the execution silently does the conversion in the background and then prints the resultant string. If there's no way to get a string, you'll wind up printing a description of the datatype. This is one of the ways that PowerShell, as ... verbose clear ... as it is, can wind up somewhat competing with other languages.

A short article on the topic, not written by me, though the author and I have a similar name.

\$\endgroup\$
7
\$\begingroup\$

Risky, 64 bytes

\22+\222]+]2:+1+:++!:++2:+*+1+0+[-*-*+02]+]2{*+++**+}+0!:+*+1+0+:+*+1+!!:+++0+0+:+0+0+0!{*++1+0+]+]+]+]+]+]+]+]+]+]+]+]+]+]+]+]

Try it online!

This is a new language made by @Radvylf. My explanation wouldn't do it justice so heres the Docs.

Explanation:

Takes the various codepoints for various characters and links them together.

Redwolf also created a version of it which is a simpler "tree" layout, which also comes in at 64 bytes:

**}+1+1!0+:+0+1+0+:+0++!0+:+0+++0+:+!++!{**+0+{+!**+0+2!+**+0+}+0+:+!++!:+*+0+{+0+:+0++!0+0+0+:+!**+0+!20+0+0+]+0+0+0+]+0+0+0+]

Try it online!

\$\endgroup\$
7
\$\begingroup\$

Halfwit -A, 15 bytes

>JM?M;J*?f?*M[?JN;k+Jkk;$<5b

Try It Online!

Halfwit is an experimental golfing language that fits most commands in half a byte. It only uses lists and integers, so the -A flag allows it to output characters.

This approach is pretty simple. The bit between > and < is the compressed integer 1408073740711211456312062497. 5 is the constant 128, which actually takes up 1.5 bytes because reasons, then b decompresses the integer into base 128.

The naïve approach of using a character list comes out at 19.5 bytes:

>*{>N;>N:>N:>Nk>;{>{+>J;>Nk>f{>N:>N{>{*

Try It Online!

Each segment between > is a base-14 compressed integer.

\$\endgroup\$
7
\$\begingroup\$

Cubestack, 65 bytes

S R2 R R2 f2 r R r R r r R' L2 R B2 R2 u r r r L r R R2 f' R b S'

Try it online!

Cubestack is a (useless) stack-based esolang that only uses moves on a Rubiks Cube. See the repository on GitHub for more information.

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

Positionally, 394 bytes

/           > \


  -
>    "!dlrow!" v
        v      <

   v  \ \   ^

  1


      
   ~

  ^           /
  <   \



      $ >    ",olleH "    .       .       .       .       .       .       .   $   .   $   .   $   .   $   .   $   .       .    v
                                                                                                                              ;<

   < >  \
      \

Try It Online!

This is so cursed. I don't really understand how it works, but it does.

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

CLC-INTERCAL, 221 bytes.

DO;1<-#13DO;1SUB#1<-#29DO;1SUB#2<-#1100DO;1SUB#3<-#249DO;1SUB#4<-#255DO;1SUB#5<-#250DO;1SUB#6<-#677DO;1SUB#7<-#373DO;1SUB#8<-#4160DO;1SUB#9<-#570DO;1SUB#10<-#2572DO;1SUB#11<-#225DO;1SUB#12<-#247DO;1SUB#13<-#348DOREADOUT;1

How I generated the code above:

#!/usr/bin/env perl

# Usage: perl $0 STRING
# Generates a code that stores given STRING
# to ;1 array in CLC-INTERCAL's binary IO model
# so it can be output by DOREADOUT;1, 
# without spaces.

my $line = shift;
my @values = unpack("C*", $line);
    my $ptr = 0;
    my @val = ();
    my $io = 172;
    for my $datum (@values) {
        my $chr = $datum;
        my $chr0 = $chr;
        my $bits0 = 0;
        my $bits1 = 0;
        for (my $i = 0; $i < 8; $i++) {
            if ($io & 0x80) {
                $bits0 <<= 1;
                $bits0 |= 1 if $chr & 0x80;
            } else {
                $bits1 <<= 1;
                $bits1 |= 1 if ! ($chr & 0x80);
            }
            $chr <<= 1;
            $io <<= 1;
        }
        $chr = int(rand 0xffff) + 1;
        for (my $i = 0; $i < 8; $i++) {
            $chr <<= 2;
            $chr |= 2 if $bits0 & 0x80;
            $chr |= 1 if $bits1 & 0x80;
            $bits0 <<= 1;
            $bits1 <<= 1;
        }
        $datum = $chr;
        $io = $chr0;
    }
print "DO;1<-#" . @values;
for my$i(0..$#values) {
   my $clcii = $i + 1;
   my $x = $values[$i] & 0xffff;
   print 'DO,1SUB#' . $clcii . '<-#' . $x if $x;
}

There is other "Hello, World!" program that uses a tail array, but it has 278 bytes when I do these:

  • Remove GIVE UP statement
  • Replace PLEASE with DO, as politeness doesn't matter in CLC-INTERCAL
  • Remove every space and LF.

Therefore I had to use binary I/O instead to shorten the program.

I think this is the only site that you can try CLC-INTERCAL online.

Edit. As of 1.-94.-2, politeness is not checked, unlike INTERCAL-72 and CLC-INTERCAL.

\$\endgroup\$
6
\$\begingroup\$

APL, 17 bytes

⎕←'Hello, World!'

This is the portable way of printing from a full program.

In the ngn/apl demo, you can omit the ⎕← for 15 bytes.

\$\endgroup\$
6
\$\begingroup\$

Sinclair BASIC, 16 bytes

PRINT "Hello, World!"

Note: PRINT on the Sinclair Spectrum is written with a single keystroke (p) and takes a single byte. The code above works on the "command line".

You can try it online at http://torinak.com/qaop. Keystrokes for that emulator: p shift-' shift-h e l l o , space shift-w o r l d ctrl-1 shift-'. Don't press shift-1 as that seems to delete the whole line.

Depending on your definition of a "full program", this may or may not be acceptable. Especially for bigger programs, you would need to use line numbers, type the whole program and then use the RUN command (keystroke r). In that case, prepend a 1 to the above code (for 1 extra byte).

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

C++, 48 bytes

(must be compiled with g++)

puts is slightly more concise than std::cout, shaving 6 bytes off of the other c++ answer.

#include<cstdio>
main(){puts("Hello, World!");}
\$\endgroup\$
11
  • 1
    \$\begingroup\$ With g++, you can eliminate the space on line 1 and the int on line 2. \$\endgroup\$
    – Dennis
    Commented Aug 29, 2015 at 3:56
  • \$\begingroup\$ @Dennis, done. I think this is the shortest possible in C++. \$\endgroup\$
    – DJMcMayhem
    Commented Aug 29, 2015 at 7:02
  • 4
    \$\begingroup\$ This is not legal C++ code. The return type of main must be int and cannot be empty. \$\endgroup\$
    – Hubi
    Commented Aug 31, 2015 at 9:34
  • 1
    \$\begingroup\$ @DJMcMayhem The fact, that compiler compiles something, does not mean, that it is correct. C++ does not support default int. \$\endgroup\$
    – Zereges
    Commented Oct 25, 2015 at 11:20
  • 1
    \$\begingroup\$ It's 47 bytes, not 48 \$\endgroup\$
    – ASCII-only
    Commented Aug 18, 2017 at 12:14
6
\$\begingroup\$

NULL, 91 bytes

int("8bxyd2qvpj6uq6gh9u8hlrjfwqkx8i2pvid5auhrsrbpp8gsczv6ye26ew0pkx05wem94m9zqkn8prqir",36)

This number represents a program, and it has 126 digits in decimal representation. I use base-36 here to shorten the number. It seems acceptable because the interpreter of NULL uses the python eval on the program before executing it (presumably to allow specifying the program as a product of prime numbers). The prime factorization (used while executing the program) is

3*3*3*17*31*73*127*139*151*157*167*197*239*241*307*367*367*419*479*499*
547*599*619*677*751*839*919*947*947*1019*1039*1097*1129*1217*1249*1301*
1303*1327*1433*1499*1543*1613*1709*1777*1873*1951*1993*2063

I found this program by using something like A* search. It tracks the state of the NULL interpreter and two additional values:

  • print - number of characters in the Hello, World! message it managed to output so far
  • length - natural logarithm of the number that represents the program

For each state, it picks 10 possible commands the language has (there are 14, but the rest are too uncomfortable to search), and calculates 10 new states. To find the shortest program, it holds the states in a priority_queue, arranged by the following cost function:

print - length / 25

If I use a fudge factor much different from 25, it either keeps searching forever (until it eats all RAM) or finds sub-optimal solutions.


BTW there is a bug in the interpreter in the generation of prime numbers. I fixed it by simplifying the code this way:

def factor_g(include_builtin_list = True):
    if include_builtin_list:
        for x in plist: yield x
    k = plist[-1] + 2
    while True:
        yield k
        k += 2
\$\endgroup\$
0
6
\$\begingroup\$

Mascarpone, 29 bytes

[!dlroW ,olleH]$.............

The esolangs page notes that

from a typical programmer's point of view, it is not obvious how to program in it

In fact, although the language's designer believes it to be Turing complete, and I personally respect his expertise in esoteric languages enough to take it on trust that it's at the very least a non-trivial language, I haven't figured out how to write a loop. So what this does is to push the characters [!dlroW ,olleH] onto the stack (the [] delimiters are necessary, and do for some reason end up on the stack too), pop the ] with $, and then print everything except the [, one character at a time.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ I know this is way late, but you can loop by having an operation call itself [!dlroW ,olleH]$[/.:!]v*:! \$\endgroup\$
    – BlackCap
    Commented Jul 21, 2017 at 14:57
6
\$\begingroup\$

Binary-Encoded Golfical, 40+1 (-x flag)= 41 bytes

Can be transpiled back into the standard graphical version using the included Encoder utility, or run directly using the -x flag.

Hex dump:

01 90 01 00 48 18 00 65 18 00 6C 18 18 00 6F 18
00 2C 18 00 20 18 00 57 18 00 6F 18 00 72 18 00
6C 18 00 64 18 00 21 18

Original image:

enter image description here

Zoomed in by a factor of 16:

enter image description here

Explanation: Uses the active cell to store values, and prints them as characters

\$\endgroup\$
6
\$\begingroup\$

Shtriped, 199 bytes

e n
e b
i b
+ x y
 +
  i x
  d y
  +
 +
 d x
0
 + b b b
1
 + b n n
 0
A
 1
 0
B
 0
 1
1
1
1
A
0
0
B
1
1
A
0
A
0
0
B
1
A
0
B
A
0
B
1
A
A
A
0
0
B
A
A
1
A
B
A
A
1
1
1
A
A
B
1
A
B
1
A
A
1
A
A
A
1
A
B
s n

(Tested in v1.0.0. Does not output trailing newline.)

Shtriped has no strings, only non-negative arbitrary precision integers. But you can print strings by encoding them as integers.

The integer that encodes Hello, World is 46758282851806618588827407. Every two digits essentially encodes one character in offset ASCII order, 82 is l, 85 is o, etc. The program basically declares the variable n to 0, and increments it one by one until it is 46758282851806618588827407, then prints it as a string. (In Shtriped, any integer larger than 0 needs to be incremented one by one to get there.)

Incrementing that high is obviously impossible in any reasonable amount of time, (a 3Ghz processor could maybe do it in 500 million years) so don't run this program, you will never see it finish! However, I am certain that it would finish, it if had the time. It should never run out of memory or have a stack overflow thanks to tail recursion optimization.

To explain what's really happening, here's a nearly identical program that will finish in a few seconds, outputting Hel. Everything is the same except the large column of 01AB's above the last line.

e n \ declare n to 0, this is the variable that will be incremented to that huge number 
e b \ declare b to 0, this is the binary place value that will keep getting doubled
i b \ increment b, making it 1

+ x y \ define a function called "+" that returns x + y
 +    \ define a nested function also called "+"
  i x \ increment x
  d y \ decrement y unless y is 0, in that case return the last statement's value
  +   \ recursively call self
 +    \ call nested "+"
 d x  \ decrement (and return) x, since we will have over counted by 1

0 \ define a function called "0" that adds b to itself, doubling it
 + b b b
1 \ define a function called "1" that adds b to n, then calls 0
 + b n n
 0

\ at this point we could set n to be any number by calling 0 and 1
\ according to the desired number's reversed binary representation
\ but these A and B helper functions help golf that part
A \ calls 1 then 0
 1
 0
B \ calls 0 then 1
 0
 1

\ call functions 0 1 A B to increment n to the desired number
B
1
1
1
1
A
0
A
0
0
A
B
1
1
\ expanding the B's and A's, this becomes 0111111001000100111
\ which reverses to 1110010001001111110 in binary
\ which is 467582 in decimal
\ which is the encoding of the string "Hel"

s n \ finally, print n as a string

Note that I'm very doubtful this answer is optimal for Shtriped. Printing each character of Hello, World! or some combinations of its substrings could be much shorter, but doing that would require lots of trial and error and mathematical calisthenics (or at least a better golfer). For now, I like this elegant, if suboptimal solution.

\$\endgroup\$
6
\$\begingroup\$

Pris, 107 bytes

(][[[]](}])]]]]){](]]][}](]]}]{]]]}](]}]{]}]]]{{}]]]{](][](}]{]}]{(]]]}](]][{](][]}](]}]{]){](]](}]{]}]{{}]

Try it out here! And here's an explanation!

(][[[]]( ; 72
}]       ; out H
)]]]])   ; 32
{]       ; 72 -> reg
(]]][    ; r += 29
}]       ; out e
(]]      ; r += 7
}]       ; out l
{]]]     ; nop
}]       ; out l
(]       ; r += 3
}]       ; out o
{]       ; set r to 72
}]]]     ; nop
{{       ; change focus
}]]]     ; nop
{]       ; 32 -> reg
(][](    ; r += 12
}]       ; out ,
{]       ; set r to 32
}]       ; out " "
{        ; change focus
(]]]     ; r += 15
}]       ; out W
(]][     ; r += 13
{]       ; 100 -> reg
(][]     ; r += 11
}]       ; out o
(]       ; r += 3
}]       ; out r
{]       ; reg -> r
)        ; "nop"
{]       ; r -> reg
(]](     ; r += 8
}]       ; out l
{]       ; reg -> r
}]       ; out d
{{       ; change focus
}]       ; out !

Now aren't you ready to take on the world? Haha, here's some help. From the README:

Pris has six functional characters, but has more commands than that. Strings of symbols have different meanings according to their number.

A Pris program is comprised of a series of meta-commands, or keywords. A keyword is made of a series of one of any of the four main construction symbols ((, ), {, and }) and some modifier symbols ([ and ]). It must start with a constructoin symbol, and this denotes a change in meta-command. For example, the string (([[][()]])[) has two meta commands: (([[][( and )]])]).

[...]

There are two registers, designated LEFT and RIGHT. One of them is "focused" and the other is "unfocused".

In the above explanation, r is the focused register. reg is the external register for holding other values. It cannot be focused on, but only accessible using {{{, or {].

\$\endgroup\$
2
  • 3
    \$\begingroup\$ My only words are "O_o" \$\endgroup\$
    – Downgoat
    Commented Mar 15, 2016 at 2:46
  • \$\begingroup\$ @Downgoat Then I have done my job. \$\endgroup\$ Commented Mar 15, 2016 at 2:50
6
\$\begingroup\$

Your Mom, 14 bytes

'Hello, World!

Explanation

'...
'... - Push the string. The ending ' is not needed at the end of program
     - Implicit output
\$\endgroup\$
1
3 4
5
6 7
34

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.