Re: A Syntax Question
Re: A Syntax Question
- Subject: Re: A Syntax Question
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 08 Jul 2014 10:11:42 -0700
- Thread-topic: A Syntax Question
Title: Re: A Syntax Question
Emmanuel and Ron have gone over this already. "is in" does not refer to an item being a member of a list - it refers to a list being a sublist of a larger list. You have to stick the item you're querying into a list (outer list brackets) to ask the question as to whether that single-item list is a sublist of the larger one.
Here the item itself is a list : {2,3}. So, yes, you have to create an (outer level) list containing that item to ask if it is "in" a similar second-level level list containing items one of which is the {2,3} item. This is all perfectly normal AppleScript behavior and has always been so. I'm sure there must be a chapter of Matt Neuburg's book that deals with this.
--
Paul Berkowitz
From: Luther Fuller <email@hidden>
Date: Tue, 08 Jul 2014 11:21:58 -0500
To: AppleScript-Users <email@hidden>
Subject: Re: A Syntax Question
Curiosity insisted that I did a little experimenting with this.
The script ...
set aList to {{1, 2}, {2, 3}, {3, 4}}
{2, 3} is in aList --> false
seems to have the correct syntax, at least according to my reading of the dictionaries.
But ... it does NOT return a correct result.
So, I tried variations on the theme and (avoiding other syntax that did not work)
I found something that does seem to work correctly ...
set aList to {{1, 2}, {2, 3}, {3, 4}}
{{2, 3}} is in aList --> true
{{1, 1}} is in aList --> false
I don't understand this syntax or why it should work.
It just doesn't make sense to me, but it seems to make sense to AppleScript.
It returns the correct result every time !!!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden