• 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: Meeting a matrix of conditions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Meeting a matrix of conditions


  • Subject: Re: Meeting a matrix of conditions
  • From: David Andrews <email@hidden>
  • Date: Tue, 14 Sep 2004 21:51:15 -0400

If you create the _matrix as suggested by Paul,
and you do not need the x, y, or (x & y) some other place in you code,
then

	set z to some item of _matrix

and the probability of any one result will be the same as Paul's code.

However, if you reduce the matrix down to just the individual components {"apple", "orange", "banana", "mango", "tomato"} then the probability of any one result will be erroneous (unless each component occurs an equal number of times in _matrix, which they do not in this example).

On Sep 14, 2004, at 3:20 PM, Paul Robinson wrote:

There's this approach:

set _matrix to {¬
"apple", "orange", "banana", "mango", "tomato", ¬
"tomato", "apple", "apple", "tomato", "apple", ¬
"orange", "banana", "banana", "tomato", "mango", ¬
"mango", "tomato", "apple", "orange", "orange", ¬
"apple", "mango", "tomato", "banana", "orange"}
set x to (ASCII number (some item of {"a", "b", "c", "d", "e"})) - 97 --set x relative to zero
set y to (ASCII number (some item of {"v", "w", "x", "y", "z"})) - 117 --set y relative to 1
set z to item ((x * 5) + y) of _matrix --get nth item of the matrix


which is good where you have to sketch out, on a bit of paper, the matrix. Cos then you just copy it into the script. If you can 'zone' the matrix (i.e. collect like results together) even better.

P.

On 14 Sep 2004, at 06:40, Joseph Weaks wrote:

I figure there must be a more clever & efficient way to do this:


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


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: This email sent to email@hidden
References: 
 >Meeting a matrix of conditions (From: Joseph Weaks <email@hidden>)
 >Re: Meeting a matrix of conditions (From: Paul Robinson <email@hidden>)

  • Prev by Date: Re: IS: Script Editor Styles Format Change Script -- WAS: Re: String to list conversion
  • Next by Date: Re: IS: Script Editor Styles Format Change Script -- WAS: Re: String to list conversion
  • Previous by thread: Re: Meeting a matrix of conditions
  • Next by thread: Re:Meeting a matrix of conditions
  • Index(es):
    • Date
    • Thread