Say I have:
set U = { "a", "b", "c" }
set V = { 1, 2, 3 }
How can I get "a1", "b2" and "c3"? (V is numbers not strings)
Almost the same code as Zero but it checks for the length of list U and V if one would be shorter than the other. The second difference is getting rid of the parentheses. When you join data in AppleScript and the first item of the join is a string then all the other values are automatically coerced into string objects.
set U to {"a", "b", "c"}
set V to {1, 2, 3}
set i to 1
set R to {}
repeat until i > (count of U) or i > (count of V)
set end of R to item i of U & item i of V
set i to i + 1
end repeat
return R
This scripts starts from your example, loops through the first array and adds the items of the second array using a counter. It then converts the new string to a list.
-- your example
set u to {"a", "b", "c"}
set v to {1, 2, 3}
-- prepare variables
set x to "" as text
set counter to 0
-- loop through the two arrays
repeat with c in u as text
set counter to counter + 1
set x to x & (c & item counter of v) & ","
end repeat
-- remove last comma
set len to the length of x
set x to characters 1 thru (len - 1) of x as text
-- convert string x to list x
set AppleScript's text item delimiters to ","
set x to every text item of x
-- display result
return x
This script produces {"a1","b2","c3"}
Here is another approach...
set U to {"a", "b", "c"}
set V to {1, 2, 3}
set text item delimiters to ","
set {U, V} to {U as text, V as text}
set text item delimiters to {return & space, return}
set X to text items 1 thru -2 of (do shell script "echo {" & U & "}{" & V & "}'\\n'")
set text item delimiters to ""