On Kafka, Confluent, and … Clojure

As I’m absorbing more of the general flavor of event-streaming and everything around it (… in the beginning was the log …), I keep gettin a bit of deja vu and realized that there’s an uncanny resemblance to something else, a different place I’ve encountered similar relationships between things in a different concrete form … in Clojure.

I feel Clojure keeps getting compared to other “languages for talking to machines”, and discussions tend to end up rehashing either the static-vs-dynamic-typing cliche, the lisp cliche(s), the scripting-Java cliche, and so on.

What is missed (I feel) is the symbolic nature of the language, which allows it to really represent concepts at an arbitrary level of abstraction … something that will be incomprehensible if all you ever compare it to is examples of computing factorials in other languages.

In particular, it is a sort of “language of the system”. The same patterns I see Apache Kafka getting involved in, for distributed data-processing systems, are the patterns I imagine with symbolic objects in Clojure code.

So instead of a log with brokers and producers and consumers and streams, I see … LazySeq, with transducers; instead of Schema Registry, spec … and so on.

This is not a fully-formed thought yet, but … dunno, I’m enjoying this parallel so far.

Monthly Curations – Jun 2019

Rediscovering an older self-version

I’ve started a new blog or a new online journal so many times, some private, some public, that I’ve really lost track of all of them. This is mildly complicated because some of them were pseudonymous.

At least on my (now deprecated?) static blog I tried to merge together older content, but I just discovered an older WordPress blog, that can best be described as “explorations in programming“.

At some point, I’m going to try to merge them together (I’m guessing that means exporting-and-importing), but it’s still a bit of a revelation to discover all this stuff I wrote, almost exactly five years ago (!)

Edit (July 11 2019): It turned out to be fairly straightforward to export the old blog and re-import it into this one — the hard part was figuring out what my login/password was, five years ago! — so this blog now goes back to 2014!

Monthly Curations: May 2019

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

Monthly Curations: April 2019