Funktion des Moduls:
zip3(X, Y, Z) when X =:= []; Y =:= []; Z =:= [] -> [];
zip3([HX | TX], [HY | TY], [HZ | TZ]) -> [ HX, HY, HZ | zip3(TX, TY, TZ)].
Dasselbe in der Schale:
F = fun(D1, D2, D3) ->
G = fun(F, X, Y, Z) when X =:= []; Y =:= []; Z =:= [] -> [];
(F, [HX | TX], [HY | TY], [HZ | TZ]) -> [ HX, HY, HZ | F(F, TX, TY, TZ)]
end,
G(G, D1, D2, D3)
end,
Data1 = [<<5>>,<<6>>,<<7>>],
Data2 = [<<5>>,<<6>>,<<7>>],
Data3 = [<<5>>,<<6>>,<<7>>],
F(Data1, Data2, Data3).
[<<5>>,<<5>>,<<5>>,<<6>>,<<6>>,<<6>>,<<7>>,<<7>>,<<7>>]
Und natürlich können Sie das auch mit lists
Modul:
lists:append(lists:zipwith3(fun(X, Y, Z) -> [X, Y, Z] end, Data1, Data2, Data3)).
[<<5>>,<<5>>,<<5>>,<<6>>,<<6>>,<<6>>,<<7>>,<<7>>,<<7>>]