• 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
A question on technique
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A question on technique


  • Subject: A question on technique
  • From: Gil Dawson <email@hidden>
  • Date: Sun, 15 Mar 2015 14:33:00 -0700

Hi--

I wish to translate a sequence of codes into corresponding mnemonics.  

Two same-length properties encode the correspondence. 

property Codes : {"9420", "94ae", "94d0", "942f", "942C", "9470"}
property Mnemonics : {"RCL", "ENM", "ReW", "EOC", "EDM", "RfW"}

Eventually I expect the two lists to be much larger.

The following code works well enough...

on MnemonicOf(aCode)
set Found to false
repeat with k from 1 to the length of Codes
if item k of Codes is equal to aCode then
set ReturnResult to item k of Mnemonics 
set Found to true
exit repeat
end if
end repeat
if not Found...

...but is there another, perhaps faster, way to do this?  

I think of constructs like... 

if aCode is in Codes then...

...but I don't see how to index the Mnemonics list.

I think of maybe using records, but I don't see quite how.

Any suggestions?

--Gil


 _______________________________________________
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

  • Follow-Ups:
    • Re: A question on technique
      • From: Axel Luttgens <email@hidden>
    • Re: A question on technique
      • From: Deivy Petrescu <email@hidden>
    • Re: A question on technique
      • From: Emmanuel LEVY <email@hidden>
    • Re: A question on technique
      • From: Barry Wainwright <email@hidden>
    • Re: A question on technique
      • From: Christopher Stone <email@hidden>
    • Re: A question on technique
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Cancel button broken
  • Next by Date: Re: A question on technique
  • Previous by thread: Re: Cancel button broken
  • Next by thread: Re: A question on technique
  • Index(es):
    • Date
    • Thread