Hello World - but alphabetically

24

4

This challenge sounds too simple to not already exist, so let me know if it is a duplicate.

The task

Print Hello, world!

The rules

Your code has to be in "byte order". This means that every character / byte has a higher or equal byte value than the preceding character / byte.

Exceptions to this rule are the whitespace characters, which may occur anywhere.

The usual loopholes are not allowed.

Edit: Using built-in functions / constants resolving to Hello, world! is not allowed.

Edit 2: The output may be a(n anonymous) function returning the string, an expression resolving to the string, or any other way you think should be allowed.

example

HW is valid: 0x48 (H) <= 0x57 (W)
print is invalid: 0x72 (r) > 0x69 (i)
but PRint is valid: 0x50 (P) <= 0x52 (R) <= 0x69 (i) <= 0x6e (n) <= 0x74 (t)

The scoring

This is so the score is the number of characters / bytes. The lower the score, the higher the ranking.

Charlie

Posted 2017-03-18T20:07:29.677

Reputation: 691

9There are many languages with 1-byte Hello World built-ins. Some may even print Hello World for an empty program. – Dennis – 2017-03-18T20:09:14.040

2Very closely related. (The difference is that that one allows each line to be sorted independently, and that it's primarily scored by the number of lines.) – Martin Ender – 2017-03-18T20:09:15.440

@Dennis Added an extra rule because of that! Thanks – Charlie – 2017-03-18T20:14:39.010

Still trivial in 23, Headsecks, and Lenguage, but much longer than a couple of bytes. – Dennis – 2017-03-18T20:29:32.093

Default output like ans = Hello, world! is that OK? Otherwise, MATLAB and Octave won't be able to attempt this... disp, printf and eval are all in non-alphabetical order. – Stewie Griffin – 2017-03-18T20:34:00.030

@StewieGriffin That is now allowed, yes – Charlie – 2017-03-18T20:41:19.837

If not for the lowercase w, Stuck would have done it in 0 bytes, since the rules disallow builtins, but the empty program isn't using a builtin.

– Erik the Outgolfer – 2017-03-18T20:47:39.980

@EriktheOutgolfer How is the empty program not a built-in? It's a builtin constant program that results in Hello, World!... – mbomb007 – 2017-03-22T16:07:28.810

Is scoring characters or bytes? It's not clear... – mbomb007 – 2017-03-22T16:08:39.733

@mbomb007 Well, I wouldn't consider a built-in program to be the same thing as a builtin function or constant, unless used as an "eval full program" argument (not just "eval"), which seems to me pretty unlikely. – Erik the Outgolfer – 2017-03-22T17:03:43.433

@EriktheOutgolfer It's a constant. And it's part of the language. AKA a built-in. – mbomb007 – 2017-03-22T18:36:14.567

Answers

15

WhiteSpace, 146 bytes

Since all whitespace may occur everywhere, this is is just the golfed Hello World program. Since whitespace doesn't show properly here, take the following program and replace all . by spaces, > by tabs and ; by newlines.

...;..>>..>.>.;..>>>>;...>;...>>>;...>..;..>>.>..;..>>..>.>>;..>>>>>>>;...>..;...>;.;...>>>.;..>>...>>;;..;.;.;>.>;...>>.>.>>;>...>;..;.;;;..>;;;;

Note

I didn't golf this, LukStorms did. His answer can be found here.

Luke

Posted 2017-03-18T20:07:29.677

Reputation: 4 675

It's not in byte order. – Matthew Roh – 2017-03-19T03:46:16.357

1Indeed, but whitespace didn't have to be in byte order; it could appear everywhere – Luke – 2017-03-19T07:31:03.950

3Oh. Good abuse of the rules then – Matthew Roh – 2017-03-19T07:47:27.417

Exactly. That's also part of the reason this is community wiki. – Luke – 2017-03-19T07:48:34.673

15

Headsecks - 124 82 chars

Thanks to @MartinEnder for pointing me to a smaller hello-world!

Headsecks looks to be the right language for the job, because its brainfuck except that it takes each character mod 8.

 +19AISYchpx£¨°»ÁËÐÞàèðøĀĈĐĘĦīİĸŀňŐŘŠŨųŻƀƈƐƘƠƪƲƺǁǏǒǟǣǫǴǸȃȈȐțȤȫȴȼɀɋɓɜɠɫɱɹʃʉʑʞʣʩʴʺ˂ˏ

You can try it by going here: https://repl.it/G2I5/1, then here: https://sange.fi/esoteric/brainfuck/impl/interp/i.html

Maltysen

Posted 2017-03-18T20:07:29.677

Reputation: 25 023

You need to post an actual Headsecks interpreter that will run this, not a Python program to convert to BF and a BF interpreter. Since the program contains non-ASCII, the interpreter you link to needs to handle non-ASCII Headsecks programs. – mbomb007 – 2017-03-22T16:15:16.837

@mbomb007 there used to be an interpreter, but it 404s now :( https://esolangs.org/wiki/Headsecks

– Maltysen – 2017-03-22T20:40:51.493

https://github.com/TieSoul/Multilang/blob/master/headsecks.py – mbomb007 – 2017-03-22T20:48:14.900

@mbomb007 that one handles unicode codepoints, but not the weird wrapping tricks that the bf helloworld uses. I'll try to look for another one, or just rollback to my earlier, longer, answer. – Maltysen – 2017-03-22T20:59:15.220

Maybe someone should create an implementation, then have Dennis put it on TIO. Also, someone should edit Esolangs. I was going to, but idr my login info. – mbomb007 – 2017-03-22T21:02:24.580

13

CJam, 784 bytes

"	 







































	 




































































	 











































































	 











































































	 














































































	 











	 	 






















































































	 














































































	 

















































































	 











































































	 



































































	 
"
"	
"')`er~

Try it online!

Not winning anything with that byte count, but this was still fun to make.

Explanation

The first large string encodes Hello, world! using only whitespace. Each character is mapped to a tab, a space, and a number of linefeeds equal to its codepoint minus 32.

Next, the string is transliterated by replacing tabs with ' and linefeeds with ). This results in many sequences of a literal space character followed by some number of increments. The string is eval'ed with ~, pushing the spaces and incrementing them to proper characters.

The stack is implicitly output at the end of the program.

Business Cat

Posted 2017-03-18T20:07:29.677

Reputation: 8 927

5Excellent, finally a truly clever answer! – ETHproductions – 2017-03-22T18:23:08.773