Came to post the same. Rosetta Code is actually a great resource for understanding the varying capabilities of different languages—the way some tasks are trivial in some languages due to powerful built-ins, while in others they have to be built up from scratch.
<groan> Hello World tells you nearly nothing about a programming language.
(Unless, of course, it's written in Java, in which case it's a painstaking tour of the entire programming language, requiring you to learn the concepts behind "class", "public", "static", "void", "main", and arrays, despite never actually using any of those things.)
This post doesn't claim to teach you about programming language. It actually contains exactly what it says on the tin: Hello World in every programming language.
When you pick up a dictionary, do you groan about it teaching you nearly nothing about human languages?
This IMHO is better https://learnxinyminutes.com/[0] if you want to see how the language looks like, because indeed "hello world" usually tells absolutely nothing.
Not really, when learning the language, most people will see it just as "stuff you do to make a main function". It's just as you don't have to look inside stdio.h to be able to #include it for a hello world program.
Would it be possible to make something better than Hello World that would showcase even more of the universal standard features of programming languages?
Any ideas?
Maybe calculate the first 10 primes and output the result? Something like that...
It should be several examples, each showing one of the following:
Iterating over infinite lists (generators, lazy seq, whatever), polymorphism (if applicable), pattern matching (if applicable), how one would pass functions around, how one would manipulate a date, how one would read and write to a file, how one would make an http request (with some error handling!), traits/mixins (or similar, if applicable) concurrency, parallelism, and use of built in List, Map data structures. While not exhaustive, to me those feel like common building blocks to my day that would showcase how easy it is to do things in a language.
"Malbolge was specifically designed to be almost impossible to use, via a counter-intuitive 'crazy operation', base-three arithmetic and self-altering code.[1] It builds on the difficulty of earlier, challenging esolangs (such as Brainfuck and Befunge), but takes this aspect to the extreme, playing on the entangled histories of computer science and encryption. Weaknesses in the design have been found that make it possible (though still very difficult) to write useful Malbolge programs."
There are thousands of programming languages, so it should be "many" rather than "every". Some important ones are missing, e.g. SNOBOL4, SASL, IPL, POP-11, SISAL, LabVIEW, Prograph.
I love this kind of stuff. The similarities and differences of programming languages is something of an obsession of mine.
In my free time over the last several years I've been working on a chrestomathy that collections solutions to Project Euler problems in various different languages [0]. I'm currently up to 39. It's certainly far from "every" language and in most languages I've only written solutions to the first handful of problems. I've learned it's hard to not learn a lot about a language if you do the first 7 or so problems in it.
70 comments
[ 22.8 ms ] story [ 508 ms ] threadTheir Hello World implementations: https://www.rosettacode.org/wiki/Hello_world/Text#BML
https://github.com/leachim6/hello-world/blob/master/e/EOOOL....
https://esolangs.org/wiki/EOOOL
"The Infamous Hello World Program.
Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S."
"This prints hello world, while being tastier than Hello World Souffle."
Some of these are so nonsensical, it's fantastic
Yes exactly!
TALK TO THE HAND "hello world"
YOU HAVE BEEN TERMINATED
No Pick/Basic[1] for a start, or Sculptor[2], as just two of the languages I've used in the past that haven't made it onto the list.
[1] https://en.wikipedia.org/wiki/Pick_operating_system [2] http://www.sculptor.co.uk/
There's even a whole web server written in LOLCODE [2]
1 : https://github.com/leachim6/hello-world/blob/master/l/lolcod... 2 : https://github.com/justinmeza/httpd.lol
I like the 'O RLY?' to start an if/else
(Unless, of course, it's written in Java, in which case it's a painstaking tour of the entire programming language, requiring you to learn the concepts behind "class", "public", "static", "void", "main", and arrays, despite never actually using any of those things.)
When you pick up a dictionary, do you groan about it teaching you nearly nothing about human languages?
[0] https://github.com/adambard/learnxinyminutes-docs
https://blogs.oracle.com/java/entry/jshell_and_relp_in_java
Any ideas?
Maybe calculate the first 10 primes and output the result? Something like that...
http://rosettacode.org/wiki/Rosetta_Code
Iterating over infinite lists (generators, lazy seq, whatever), polymorphism (if applicable), pattern matching (if applicable), how one would pass functions around, how one would manipulate a date, how one would read and write to a file, how one would make an http request (with some error handling!), traits/mixins (or similar, if applicable) concurrency, parallelism, and use of built in List, Map data structures. While not exhaustive, to me those feel like common building blocks to my day that would showcase how easy it is to do things in a language.
"Malbolge was specifically designed to be almost impossible to use, via a counter-intuitive 'crazy operation', base-three arithmetic and self-altering code.[1] It builds on the difficulty of earlier, challenging esolangs (such as Brainfuck and Befunge), but takes this aspect to the extreme, playing on the entangled histories of computer science and encryption. Weaknesses in the design have been found that make it possible (though still very difficult) to write useful Malbolge programs."
[0]https://en.wikipedia.org/wiki/Malbolge
chicken chicken chicken chicken chicken chicken
chicken
https://github.com/leachim6/hello-world/blob/master/m/Mmmm()...
In Full Metal Jacket (not released yet), "Hello computer" is shown at http://web.onetel.com/~hibou/fmj/tutorials/FirstSteps.html
In Prograph, it's similar. In LabVIEW, it's also similar, except that data flows from left to right.
In my free time over the last several years I've been working on a chrestomathy that collections solutions to Project Euler problems in various different languages [0]. I'm currently up to 39. It's certainly far from "every" language and in most languages I've only written solutions to the first handful of problems. I've learned it's hard to not learn a lot about a language if you do the first 7 or so problems in it.
[0] https://github.com/seaneshbaugh/rosetta-euler