▲ | jallmann 4 days ago | |
> That seems pretty hard to read at a glance, and easy to mistype as a definition. YMMV but let expressions are one of the nice things about OCaml - the syntax is very clean in a way other languages aren't. Yes, the OCaml syntax has some warts, but let bindings aren't one of them. It's also quite elegant if you consider how multi-argument let can be decomposed into repeated function application, and how that naturally leads to features like currying. > Also, you need to end the declaration with `in`? Not if it's a top level declaration. It might make more sense if you think of the `in` as a scope operator, eg `let x = v in expr` makes `x` available in `expr`. > Then, semicolons... Single semicolons are syntactic sugar for unit return values. Eg,
is the same as
|