My Worrisome Lists :-)
My Worrisome Lists :-)
- Subject: My Worrisome Lists :-)
- From: Stephen Swift <email@hidden>
- Date: Sun, 03 Feb 2002 20:01:57 -0500
- Method-key: Ydco m.ooai. jrm.o uprm yd. e.ot ru Oy.ld.b Xgpbdam O,cuyv
It's probably come up again and again but, I'd really like to be able to
create records like so:
{"Bob":{1,2},"Jane":{3,4},"Dan":{5,6}}
Is AppleScript ever going to be able to use strings as records? Or is this
a feature of a newer AS version? I have Mac OS 8.6 (AS 1.3.7).
What I'm trying to do is a value is returned in a form of a string such
The_name
--> "Ann"
And I'd like to create a record "Ann" but I can't. So I've just gone with
creating a list.
Set list1 to {"Bob",1,2,"Jane",3,4,"Dan",5,6}
But then my problem is what item is "Jane" in list1?
I'm forced to do a repeat loop until item i is "Jane"
Unless I'm forgetting a way of determining what item # certain data is. How
do you normally determine what item # something is? Do you use a repeat
loop, or do you know of a better way?
I wish there was something like
Item "Jane" of list1
--> 4
And then there is the whole problem with contains
set list1 to {"Bob", 1, 2, "Jane", 3, 4, "Dan", 5, 6}
list1 contains "Jane"
--> true
set list2 to {{"Bob", 1, 2}, {"Jane", 3, 4}, {"Dan", 5, 6}}
item 2 of list2 contains "Jane"
--> true
set list2 to {{"Bob", 1, 2}, {"Jane", 3, 4}, {"Dan", 5, 6}}
items of list2 contains "Jane"
--> false
--is there an 'any item' object or equivalent?
set list2 to {{"Bob"}, {"Jane"}, {"Dan"}}
list2 contains {{"Jane"}}
--> true
set list2 to {{"Bob", 1}, {"Jane", 2}, {"Dan", 3}}
list2 contains {{"Jane"}}
--> false
I'm trying to determine if any "Jane" is contained in any of the sub-lists
of list2 without using a repeat loop. But I'm running into a brick wall.
Any help?
To sum it up. My problems are:
1) I can't use strings as records.
2) I can't find the item # of an item w/out using a repeat loop
3) I can't find out if an item is contained in a sub-list w/out using a
repeat loop.
If anyone would like to administer a dope slap and show me the solution I'm
obviously overlooking, please, please do so. :-)
Stephen Swift
email@hidden
-----------------------------------------------
AppleScript Guru - The Mac Observer
http://www.macobserver.com/tips/applescript