builder: Old OCaml didn't have List.iteri, so add a utility function.