@hrefna (jane street.)
@hrefna @ELLIOTTCABLE 'iter f lst' vs. 'iter lst f' is because of two conflicting idioms: partial application (let print_list = List.iter f) vs. anonymous functions:
List.iter lst (fun x ->
<a bunch of code>
)
For the other examples, I'm not sure what you were expecting. Creating tuples is expensive, so iterating over a key/value container won't have the same signature as iterating over a set (e.g. Hashtbl.iter takes (fun key value -> ...), not (fun (key, value) -> ...)). It's not something that's bothering me, so it must be a cultural thing 🙂
@hrefna @ELLIOTTCABLE also, the labeled versions of iter were designed to allow flipping the arguments depending on the situation. I don't like to use labels for such simple functions, though.
In recent years, we were blessed with the pipeline operator `|>` , which makes the original List.iter reasonable again without having to resort to labels:
lst |> List.iter (fun x ->
<a bunch of code>
)