• 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: coerce lists to records
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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"}


  • Follow-Ups:
    • Re: coerce lists to records
      • From: Bill Cheeseman <email@hidden>
References: 
 >coerce lists to records (From: Patrick Wynne <email@hidden>)

  • Prev by Date: Re: Count selected pixcel with Photoscripter
  • Next by Date: Re: Offset in paragraphs
  • Previous by thread: coerce lists to records
  • Next by thread: Re: coerce lists to records
  • Index(es):
    • Date
    • Thread