RosettaCodeData/Task/Loop-over-multiple-arrays-simultaneously/Standard-ML/loop-over-multiple-arrays-simultaneously.ml

10 lines
275 B
OCaml
Raw Permalink Normal View History

2013-04-10 22:43:41 -07:00
(*
* val combine_lists : string list list -> string list
*)
fun combine_lists nil = nil
2015-11-18 06:14:39 +00:00
| combine_lists (l1::ls) = List.foldl (ListPair.map (fn (x,y) => y ^
x)) l1 ls;
2013-04-10 22:43:41 -07:00
(* ["a1Ax","b2By","c3Cz"] *)
combine_lists[["a","b","c"],["1","2","3"],["A","B","C"],["x","y","z"]];