Is there a fast way to convert a flat list into a list of two-tuples such that a flat list like [1,2,3,4,5,6] becomes [{1,2},{3,4},{5,6}]?
This works, but it feels just plain WRONG:
tuples_from_flat_list(Target) ->
TargetWithIndex = lists:zip(lists:seq(1, length(Target)), Target),
{K, V} = lists:partition(fun({I, _}) -> I rem 2 == 1 end, TargetWithIndex),
lists:zipwith(fun({_, X}, {_, Y}) -> {X, Y} end, K, V).