“Hello World” in Ocaml

I was curious if Zig was as good as Nim about “minimalist hello-world” builds (yes, a ridiculous metric, but still …), and found that yes, it was quite similar, but was surprised to find that Ocaml did one better on them(!)

➜  ocaml-playground cat hello_world.ml

print_string "Hello World from Ocaml !!\n"

(Yes, that’s it, just one line)

➜  ocaml-playground ocamlc hello_world.ml -o hello_world

➜  ocaml-playground ./hello_world
Hello World from Ocaml !!

➜  ocaml-playground l hello_world
.rwxr-xr-x 18k agam 25 May  0:45 hello_world

Just 18K, under half of Nim and much lower than anything else on this list!

(This is with ocamlc version 4.06.1 on Debian 9.6)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s