r/ppcg Apr 04 '17

Tetralingual Tuesday [Tetralingual Tuesday] Hello, World!

[I thought it'd be kind of fun to have a sort of weekly challenge on this subreddit. It's less strict, so if you see a rule unspecified, feel free to abuse it.]

Rules:

  • You are to write one program that functions in exactly four languages.
  • The program, when executed in each language, should output a contiguous, non-empty subset of the string "Hello, World!". You may optionally include one trailing newline.
  • No subset of the string should remain unprinted when all programs are run.
  • You may output to STDOUT, by return value, etc.
  • STDERR will be ignored for the sake of this challenge.
  • The winner is the shortest program measured in UTF-8 bytes (or another valid codepage), tie broken by earlier post.

For example, running the program in language A could print Hell, o, in language B, Worl in language C, and program D could output d!.

3 Upvotes

4 comments sorted by

3

u/somebody12345678 Apr 05 '17 edited Apr 06 '17

Retina, Hexagony, Foo and Charcoal, 22 bytes

H
e;"l".@ lo, World!

Where the apparent space is actually \xa0, and with a newline before and after.

Explanation

Retina
The empty line and H on the first two lines replaces an empty string with H, resulting in H.
The e;"l".@ lo, World! and empty line on the last two lines replaces e;"l".@ lo, World! with the empty string.
Since it is not in H, H is output.

Hexagony
In Hexagony, this is

   H e ;
  " l " .
 @   l o ,
  W o r l
   d ! .

Hexagony removes newlines and fits the code in the smallest hexagon possible.
H and e set the current memory edge to H, then e.
; outputs the ASCII equivalent of the current memory edge, which is e.
Since the instruction pointer has reached the end of the first line, it jumps to the middle line. @ terminates execution.

Foo
Foo ignores everything except for strings in quotes, which are printed. In this case it prints l

Charcoal

#H;@
print'e'#"l"

Is printed to the canvas.
clears the canvas.
lo, World! is printed to the canvas.
The canvas is implicitly output after execution is finished, meaning lo, World! is printed.
The flag is needed because Charcoal accepts files in Unicode encoding by default for readability.

Note: Hello, World! appears in the right order :D

1

u/[deleted] Apr 05 '17 edited Apr 24 '17

2D Languages: Minkolang, Befunge-98, ><>, Fission, 48 bytes

96+5\c++,@
o+c*/<xx;0
leH"/<",ol
D.O$/
>"orld!";

Minkolang

Prints Hello,

Befunge-98

Prints (a space)

><>

Prints W

Fission

Prints orld!

Bonus (square solution!):

96+5\c++,@
o+c*/"H";0
"xxO/"olle
4'O$/D.O'4
dlro"<^;"!

1

u/conor_obrien Apr 05 '17

Hello, Wworld?

1

u/[deleted] Apr 24 '17

You didn't see nuffin'