let expand_assoc_list tal =
let ans = Caml.Hashtbl.create 100 in
let insert (t,a) =
for i = t.lo to t.hi do
let prev = try Caml.Hashtbl.find ans i with Not_found -> [] in
Caml.Hashtbl.replace ans i (a::prev)
done
in
let _ = List.iter ~f:insert tal in
let ans = Caml.Hashtbl.fold (fun key value ans -> (key,value)::ans) ans [] in
List.rev (List.map ~f:(fun (i,al) -> i, List.rev al) ans)