1. Unique Set

Okay, I want to prevent a set of six numbers from being a duplicate in a
sequence of sets of six numbers...

For example:

a = { 1, 2, 3, 4, 5, 6 }

b = { { 1, 2, 3, 4, 5 ,7 } , { 1, 2, 3, 4, 5, 8 } , { 1, 2, 3, 4, 5, 6} ,
... }

What's the fastest IsAinB( a, b ) function? I'm not sure if find() or
match() would work here, but I'll check. Otherwise, I'm sure some of our
resident speed experts can come up with a speedy solution.

Thanks!

<\<



__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

new topic     » topic index » view message » categorize

2. Re: Unique Set

Hello ck,

>Okay, I want to prevent a set of six numbers from being a duplicate in a
>sequence of sets of six numbers...
>What's the fastest IsAinB( a, b ) function? I'm not sure if find() or
>match() would work here, but I'll check. Otherwise, I'm sure some of our
>resident speed experts can come up with a speedy solution.

I'm pretty sure that find() will do just that.
Remember find() returns the LOCATION of the first instance
but also remember that any NON-ZERO value is interpreted
as TRUE so you can say:

if find (a, b) then -- returns 0 if NOT found
  -- do nothing
else
  b &= {a}
end if

later,
Lewis Townsend
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu