"Zig doesn’t have lambdas"
This surprises me (as a C++ guy). I use lambdas everywhere. What's the standard way of say defining a comparator when sorting an array in Zig?
You can declare an anonymous struct that has a function and reference that function inline (if you want).
There's a little more syntax than a dedicated language feature, but not a lot more.
What's "missing" in zig that lambda implementations normally have is capturing. In zig that's typically accomplished with a context parameter, again typically a struct.
Same as C, define a named function, and pass a pointer to the sorting function.
Normal function declarations.
This is indeed a point which makes Zig inflexible.