Used lists:flatmap/2 instead of lists:foldl/3 . lists:append/2. lists:reverse/1 not needed as order will not matter.
There order is good again, as it was after 2 app of lists:foldl/3. Replaced lists:foldl/3 over a list to a lists:flatmap/2.
A list of fixed size? A tuple.