combineLists

Combines a list of lists, and creates a new list of lists, where the first member contains the first members or each of the original lists, and so on…

OS version: Any

(*
combineLists
Combines a list of lists, and creates a new list of lists, where the first member contains the first member or each of the original lists, and so on...

Parameters:
listOfLists: list of lists with the same length. It the provided lists are not of the same length, it will return a list based only in the first member of the list.

Example:
set list1 to {"a", "b"}
set list2 to {1, 2}
set list3 to {"I", "II"}
set listOfLists to {list1, list2, list3}
combineLists(listOfLists) --> {{"a", 1, "I"}, {"b", 2, "II"}}

*)

to combineLists(listOfLists)
	script foo --> speed-up processing, credits to some gurus
		property theList : listOfLists
	end script
	set nl to {}
	repeat with i from 1 to count foo's theList's item 1
		set nl's end to {}
		repeat with x from 1 to count foo's theList
			set end of nl's item -1 to foo's theList's item x's item i
		end repeat
	end repeat
	nl
end combineLists

property |version| : 1.0
property author : "Pescados Software · PescadosWeb.com"
property |date| : date "jueves, 16 septiembre 2004 18:11:19"
property license : "freeware, open-source"