collect function

Collect elements from a list of lists