As is customary we will start out with hello world. The aim of this blog is to present material that I consider interesting. Hopefully someone out there finds its either educational or entertaining. If not at least I had fun creating it :)
I am not quite sure what the point of this particular post is, but hopefully we will figure that out as we move along. Lets jump in.
Below is examples of hello world programs in different languages. Despite the simplicity of the programs you can already see design decisions. Printing is one of the most basic features of any useful language, yet it is done differently. In two cases we utilize monads, which will be the subject of a later post. Requiring printing which is strictly speaking IO and thus a sideeffect to go through monads is what makes these languages pure (as in purely functional). This will also be the subject of a later post. But for now let's just look at silly programs.
Java
public class HelloWorld {
public static void main(String[] args){
System.out.println("Hello world");
}
}
Go
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
Scala
object HelloWorld extends App {
println("Hello world")
}
Haskell
module Main where
main :: IO ()
main = putStrLn "Hello, World!"
Purescript
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
main :: forall e. Eff (console :: CONSOLE | e) Unit
main = do
log "Hello, World!"
Rust
fn main() {
println!("Hello World!");
}