MACSCRPT Archives

July 2007

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
Macintosh Scripting Systems <[log in to unmask]>
Mime-version:
1.0
Date:
Fri, 27 Jul 2007 14:00:22 -0700
Reply-To:
Macintosh Scripting Systems <[log in to unmask]>
Content-type:
text/plain; charset="US-ASCII"
Subject:
From:
Stan Cleveland <[log in to unmask]>
In-Reply-To:
Content-transfer-encoding:
7bit
Parts/Attachments:
text/plain (30 lines)
On 7/27/07 1:59 PM, RJay Hansen wrote:

> I want to create a list containing other lists but can't seem to
> figure out how to do it. When I create a new, empty list then try to
> add already-created lists, those lists lose their "listness", i.e.
> their contents just become items in the new list. For example:
> 
> set thisList to {1, 2, 3}
> set thatList to {"a", "b", "c"}
> set bothLists to {}
> set bothLists to ((bothLists & thisList) & thatList)
> 
> ---> {1, 2, 3, "a", "b", "c"}
> 
> but I want to get:
> 
> ---> {{1, 2, 3}, {"a", "b", "c"}}
> 
> Can this be done?

Try this:
    set thisList to {1, 2, 3}
    set thatList to {"a", "b", "c"}
    set bothLists to {}
    set end of bothLists to thisList
    set end of bothLists to thatList
    --> {{1, 2, 3}, {"a", "b", "c"}}

Stan C.

ATOM RSS1 RSS2