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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
);
say map{ chr @$_ } @hello_world;
That seemed like a lot of writing to me, so I used this to generate the above code:
perl -E'
say for map{"use $_;"} qw"strict warnings 5.010";
say "my \@hello_world = (";
say " [",join(",",@$_),"]," for map{[(0) x ord]} split //, "Hello World";
say ");";
say q"say map{ chr @$_ } @hello_world;"
'
I hope by "numbers" you mean "numeric constants", because there probably wouldn't be much programming left without. – J B – 2011-03-11T21:42:35.623
Numeric literals/constants, yes. – zzzzBov – 2011-03-11T21:45:01.640
So stuff like
?!
(character value of"!"
in Ruby 1.8) would be allowed, then? – Ventero – 2011-03-11T21:53:14.860I'm not familiar with Ruby's syntax, is
?!
a special string literal? I consider RegEx literals like/Hello World/
to be too similar to string literals. – zzzzBov – 2011-03-11T21:55:59.273In Ruby 1.8,
?x
is the character value of the characterx
. So for example?a
is 97,?A
is 65 and?!
is33
. It's not a string, I'm just not sure if it fits your definition of a numeric literal. – Ventero – 2011-03-11T21:57:38.4304One of [code-golf] and [code-challenge] please, not both. The point of these tags to to help people find questions with the rules they want to use. Essentially every question on this site should be a game of some kind or another. – dmckee --- ex-moderator kitten – 2011-03-11T22:29:15.550
4
-1 We've already had Obfuscated Hello World, and I think this challenge is too similar. I'd have cast a "close as duplicate" vote, if I weren't a mod.
– Chris Jester-Young – 2011-03-11T22:35:28.100@Chris Jester-Young, I feel that this version of the hello world problem is different enough, if purely because it's more difficult. It'd be like saying this should be closed just because it's a "Hello World" problem. – zzzzBov – 2011-03-11T23:37:04.760
2@zzzzBov: I don't think it's different enough to warrant another question in the "hello world" theme; a different theme would have been better. But, that's just my opinion. – Chris Jester-Young – 2011-03-11T23:39:15.083
1I think this is a fine code golf - and better than the prior one. – MtnViewMark – 2011-03-12T06:58:11.860
2Some people seem to assume that
"O"*
means they can have a string literal with any number of O’s, including zero. I don’t think that was the intention. Please clarify. – Timwi – 2011-03-12T21:12:38.363@Timwi, Multiple "O"s are fine, "" (an empty string literal) is not. Dilbert never mentioned using single "O"s in his programs. – zzzzBov – 2011-03-13T07:38:17.393
BTW, where did that comic come from? – Kevin Cox – 2013-11-22T15:13:20.947
@KevinCox, I completely forgot to credit the source! It's a Dilbert comic from 1992.
– zzzzBov – 2013-11-22T15:26:52.833I thought it looked like Dilbert, it's amazing how the art style has changed though. – Kevin Cox – 2013-11-22T15:43:48.987
How would you solve this in Seed? – TehPers – 2017-07-26T18:09:33.300
Are we allowed to output
Hello, World
with a comma? – VFDan – 2019-05-22T20:01:22.437@VFDan, no the question clearly shows the output as it is expected. – zzzzBov – 2019-05-22T21:18:13.877
@zzzzBov OK, if we were able to write
Hello, World!
, I could write a 0 byte program in stuck that does this – VFDan – 2019-05-22T21:20:23.297@VFDan, the standard loopholes apply.
– zzzzBov – 2019-05-22T21:22:42.787@zzzzBov IK, but Stuck was not designed to be a language that just prints
– VFDan – 2019-05-22T21:26:02.193Hello, World!
. It actually is a legitimate programming language, just made for golfingCan I even use Bash, given that command-line arguments are literals AFAIK? – None – 2014-04-13T12:43:17.817