Re: coerce lists to records
Re: coerce lists to records
- Subject: Re: coerce lists to records
- From: Yosemite <email@hidden>
- Date: Fri, 17 Nov 2000 06:42:51 -0900
-- i am sure there are better ways but this does work
set aList to {"firstname", "Robert", "lastname", "Robertson"}
set aRec to {}
repeat with i from 1 to ((number of items in aList) / 2)
set l to item (i * 2 - 1) of aList
set v to item (i * 2) of aList
set bRec to run script ("set bRec to {" & l & ":\"" & v & "\"}")
set aRec to aRec & bRec
end repeat
-- hcir
mailto:email@hidden
I have a feeling that this isn't possible, but is there any way to
coerce a list of strings into a record, with the odd-numbered strings
as the record labels?
Example:
{"firstname", "Robert", "lastname", "Robertson"}
becomes
{firstname: "Robert", lastname: "Robertson"}