I have 2 list:
List1 = [1,2,3].
List2 = ["asd", "sda", "dsa"].
How can i print this list in following turn:
1 asd 2 sda 3 dsa
Thank you.
sometimes it's better to reinvent the wheel. in case of erlang - just to understand recursion, tail calls and how to work with lists.
f([], []) ->
ok;
f([H1|R1], [H2|R2]) ->
io:format("~p ~p", [H1, H2]),
f(R1, R2).
1> lists:zipwith(fun (X1, X2) -> io:format("~p ~p ", [X1,X2]) end, List1, List2).
1 "asd" 2 "sda" 3 "dsa" [ok,ok,ok]
2>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With