• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: list of records
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: list of records


  • Subject: Re: list of records
  • From: Paul Berkowitz <email@hidden>
  • Date: Mon, 11 Dec 2000 16:45:22 -0800

On 12/11/00 1:14 PM, "Frank Watzl" <email@hidden> wrote:

> set r to {FileType:"LINK", CreatorType:"MSIE"} -->record
> set L to {{FileType:"LINK", CreatorType:"MSIE"}, "foo", {FileType:"PICT",
> CreatorType:"8BIM"}} --> 3 item list
> r is in L -->false **why not true?
> r = item 1 of L -->true **aah!
>
> Any Ideas why in the 3rd line the result is false?



{r} is in L -->true

The class of the item contained must be the same as the container in any
expression using 'contains' or its converse 'is in': list, record or string
on both sides of the "contains, "is contained by" ("is in") operator. L is
a list, but r is a record, so you must express r as a one-item list {r}

Most of the time we neglect this without problem, because we are looking for
a string in a list of strings:

set s to "a"
set L to {"a", "b", "c"}

s is in L --> true


but that's because AppleScript generously coerces a 'single item' (string or
number) to a single-item list

s is in L --> coerced to
{s} is in L --> true

But it can't do that with a record.

See the ASLG pp 227-9.





--
Paul Berkowitz


References: 
 >list of records (From: Frank Watzl <email@hidden>)

  • Prev by Date: Free ISP question
  • Next by Date: Re: scripting Photoshop
  • Previous by thread: Re: list of records
  • Next by thread: Re: list of records
  • Index(es):
    • Date
    • Thread