Problem 2 Write a function that combines two lists by alternatingly taking elements. For example: given the two lists [a, b, c] and [1, 2, 3], the function should return [a, 1, b, 2, c, 3].
function interleave X,Y split X using comma split Y using comma repeat with i = 1 to max(item 2 of the extents of X,item 2 of the extents of Y) put X[i],Y[i],"" after R end repeat return char 1 to -2 of R end interleave Test Data (taken in pairs of lines) 1,2,3 a,b,c 1,2,3 a,b,c,d 1,2,3 Test Output 1,a,2,b,3,c ,1,,2,,3 a,1,b,2,c,3,d, _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode