On 7/27/07 2:12 PM, Gary (Lists) wrote:
> "RJay Hansen" wrote:
>
>> Can this be done?
>
> Yes, but you have to follow AppleScript's rules. ;)
>
> set _list1 to {1, 2, 3}
> -- {1, 2, 3}
> set _list2 to {"a", "b", "c"}
> -- {"a", "b", "c"}
>
> set _list3 to _list1 & _list2 -- make a list out of two lists
> -- {1, 2, 3, "a", "b", "c"}
>
> set _list3 to _list1 & {_list2} -- add a list to a list
> -- {1, 2, 3, {"a", "b", "c"}}
>
> copy _list2 to end of _list1 -- add a list to a list
> -- {1, 2, 3, {"a", "b", "c"}}
>
> copy {"x", "y", "z"} to item 2 of _list1 -- replace an list item with a list
> -- {1, {"x", "y", "z"}, 3, {"a", "b", "c"}}
And here are two more methods:
set bothLists to {_list1, _list2} -- make a list out of two lists
-- {{1, 2, 3}, {"a", "b", "c"}}
set beginning of _list1 to _list2 -- add a list to the front of a list
-- {{"a", "b", "c"}, 1, 2, 3}
Stan C.
|