Re: count of items in a reference to a list
Re: count of items in a reference to a list
- Subject: Re: count of items in a reference to a list
- From: John W Baxter <email@hidden>
- Date: Mon, 9 Jul 2001 11:36:21 -0700
At 10:37 -0700 7/9/2001, Michelle Steiner wrote:
>
On 7/9/01 9:48 AM, email@hidden <email@hidden> wrote:
>
>
>set x to {"a", "b", "c"}
>
>set countx to count of items in x
>
>log countx
>
>--> 3
>
>set xr to a reference to x
>
>set countxr to count of items in xr
>
>--> every item of x of<<script>> doesn't understand the count message.
>
set x to {"a", "b", "c"}
set countx to count of items in x
log countx
--> 3
set xr to a reference to x
set countxr to count of items in contents of xr
will work, as will various forms which don't talk about items
count xr
count of xr
and the left-field way:
set countxr to length of xr
I would usually say count of xr, except in this sort of variant:
set x to {"a", "b", "c", 4}
set countx to count of items in x
log countx
--> 3
set xr to a reference to x
set countxr to count plain text in contents of xr
--> countxr contains 3
(note: I wrote "strings" and that compiled to "plain text"). That result
is 3; substitute "numbers" for "plain text" and the result is 1.
--John
--
John Baxter email@hidden Port Ludlow, WA, USA