“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)

“Hello World” in Zig

  • Creating
➜  zig-playground git:(master) ✗ cat src/main.zig
const std = @import("std");

pub fn main() !void {
    var stdout_file = try std.io.getStdOut();
    try stdout_file.write("Hello from Zigland!\n");
}
  • Running
➜  zig-playground git:(master) ✗ zig build run
Hello from Zigland!
  • Looking at builds:
➜  zig-playground git:(master) ✗ l zig-cache/o
drwxr-xr-x - agam 20 May 18:34 1FaU34FwI7Ct04pmfOlMacuOykIOisQtTn1t1Q3lrQOZcsEF0qxJW3vLauzHjpwm
drwxr-xr-x - agam 20 May 18:36 fyjPplfax8VTFYlidzFwMj_gV5Dw_T9T4PVTNBaOPnxDE5dq2XRo28L0b-87xi0l
drwxr-xr-x - agam 20 May 18:36 r-sdQS7ThLQpXn2OhOye0gD2RSuygbP_R6dWnLJZKjgjdWqQxTSCKB3dHKbWucMG
drwxr-xr-x - agam 21 May 23:21 XxkweE8uWyMc9LocxqJMMKAwTGgBzcn4q3bEKH1tL8Kx-F5Gk3kopgQqLbVLXVbh
  • Debug build size:
➜  zig-playground git:(master) ✗ l zig-cache/o/r-sdQS7ThLQpXn2OhOye0gD2RSuygbP_R6dWnLJZKjgjdWqQxTSCKB3dHKbWucMG/zig-playground
.rwxr-xr-x 406k agam 20 May 18:36 zig-cache/o/r-sdQS7ThLQpXn2OhOye0gD2RSuygbP_R6dWnLJZKjgjdWqQxTSCKB3dHKbWucMG/zig-playground
  • “Release build” size:

zig build -Drelease-small=true

➜  zig-playground git:(master) ✗ l zig-cache/o/XxkweE8uWyMc9LocxqJMMKAwTGgBzcn4q3bEKH1tL8Kx-F5Gk3kopgQqLbVLXVbh/zig-playground
.rwxr-xr-x 53k agam 21 May 23:21 zig-cache/o/XxkweE8uWyMc9LocxqJMMKAwTGgBzcn4q3bEKH1tL8Kx-F5Gk3kopgQqLbVLXVbh/zig-playground

So, 406k for the debug build, 53k for the release build, very similar to Nim here, and comparing very favorably indeed to Rust or Go (!)

Continuing thoughts about the “static blog”

After some deliberation, I feel there’s no point in either (1) keeping a separate static-only blog and this blog, or (2) keeping two separate WordPress blogs, because

  • I don’t have the mind space for that. It’s straightforward to have one place for everything
  • If I did want to have a place for code snippets today, they would either belong in a shared dynamic environment, such as repl.it or nextjournal.

So, I’m going to rely on Categories to keep different posts siloed away, and see how that goes …

Previous, unpublished post:

(Found this in my drafts folder, might as well throw it out …)

I’m still thinking through this … when I first looked around, I thought Tumblr was a good candidate for the sort of “snippet-heavy” (gists, quotes, screenshots) that I anticipate throwing into my static blog.

Given that WordPress is actually something I use (for this blog, right here!) and the fact that a new “block-based” editor/design just rolled out, I’m now wondering if I should import my existing Tumblr into a new WordPress blog and just use that instead.

It’ll mean I’ll have two separate WordPress blogs … but that doesn’t seem too bad. This raises the obvious question of … why not have just one blog? Well, because they seem different (in my head, anyway): one is more of a “semi-organized summary of life and interests”, while the other is a sort of “scrapbook of anything connected to programming, computing, commentary and snippets, bits of explorations”.

Anyway, I’ll decide something soon (I hope!)

Monthly Curations: April 2019

Interesting links: April 2019

The lost city of Thonis, in the Bay of Aboukir

Monthly recap (April 2019)

Driving through a wall of fog on an weekend trip to Half Moon Bay (the temperature dropped ten degrees on the other side!)

Major updates:

  • Couple of hikes with Shivi and Tara, including one over-ambitious one
  • Tara had her first surgical operation 😦 … an endoscopy … and it turns out she has to be on a gluten-free diet, forever.

Minor updates:

  • Misadventures with filing taxes, due to some TurboTax “feature” that led to me printing out and Fedex-ing out my returns on literally the last day
  • Bunch of weekend meetups with a bunch of people, some of them after a long time.

Watched/read:

  • Umbrella academy” on Netflix
  • Gully boy” on Netflix
  • Two shows by Gad Elmaleh (Huge in France and his standup)
  • Vice” (bought the movie on Amazon)
  • Finished listening to “Sapiens
  • Finished reading “Deep Work