[erlang-questions] [erlang-question] How to comprehend two lists synchronously?

Richard O'Keefe <>
Sun Nov 20 23:47:53 CET 2011


On 18/11/2011, at 6:45 PM, Barco You wrote:

> Dear Erlangers,
> 
> 
> I hope to get a list from two lists like this:
> [{a1,b1}, {a2,b2}, {a3,b3}]      <-     [a1, a2 a3],  [b1, b2, b3].

This is 'zip'.  Erlang's current list comprehension syntax cannot do
that.  There is an EEP proposing an extension that would handle it.
Right now, you have to use lists:zip/2.




More information about the erlang-questions mailing list