is among - problem
Thomas J McGrath III
3mcgrath at adelphia.net
Sat Nov 22 07:53:58 EST 2003
THAT's IT...... You got it right.
I knew it was going to be something like that.
Thanks Steve,
Tom
On Nov 22, 2003, at 3:14 AM, Steve Laming wrote:
> Hi Thomas
>
> Without running and testing it, which I may be able to do over the
> weekend, my initial suggestion would be that as you are counting up
> the set of numbers and deleting frin the original set. It is likely
> that some of the target numbers are moved with each deletion and
> therefore not tested at all. as in
>
>
> start numbers
>
> 123
> 321
> 213
> 413
> 356
>
> (psuedo code)
>
> loop with i = 1 to 5
>
> if item x is a hit then delete item x
>
> repeat
>
> list is now
> 321
> 213
> 413
> 356 and x is 2
>
> therefore the new top item does not get tested.
>
> If you change the line of code to start at the back ofthe list, the
> problem goes away.
>
> Steve
>
>
> At 20:49 21/11/03 -0500, you wrote:
>> Steve, I see the coding bug got you, too. I used to spend nights
>> rewriting scripts with a friend of mine (who's name is steve too) and
>> we would try to get it down to the smallest number of lines. Ahh the
>> good old days.
>>
>> Anyway, the problem called for no duplicate numbers in each group of
>> three So 112, and 333 would be out completely but the code I used to
>> create the field did that for me, already. The actual group was
>> 1,2,3,4,5,6,7 and then finding every combination of a group of three
>> that did not overlap in any way SO 123 and 312 could not work and 112
>> was no good etc.
>>
>> The answer I came up with was 35 possible combinations. The numbers I
>> came up with will follow in my next email.
>>
>> And yes I know the code was wordy but that was because I actually was
>> putting separate code from three different sources together and never
>> tried to clean it up.
>>
>> My real problem was that "is among" was not finding sets of groups
>> that were similar but transposed. In my need to find a solution I
>> added the part about converting a line like 123 into 1,2,3 so that
>> "is among" could work.
>>
>> I really want to understand why it didn't work though. Any clues???
>>
>> Thanks
>> Tom
>>
>> On Nov 21, 2003, at 8:11 PM, Steve Laming wrote:
>>
>>> Ooops, 222 still gets deleted, so it would be better to explicitly
>>> test for duplicates than rely on the addition test therefore:
>>>
>>>
>>>> On MouseUp
>>>> put false into found
>>>> put "1,2,3" into search$
>>>> -- sort field "myList"
>>>> repeat with x = the number of lines in field "myList" down to 1
>>>> put char 1 of line x of field "mylist" into test1
>>>> put char 2 of line x of field "mylist" into test2
>>>> put char 3 of line x of field "mylist" into test3
>>>> If test1<>test2 And test1<>test3 AND test2<>test3 then
>>>> If test1 is among the items of search$ and test2 is among the
>>>> items of search$ and test3 is among the items of search$ then
>>>> If found then
>>>> delete line x of field "myList"
>>>> beep
>>>> else
>>>> put true into found
>>>>
>>>>
>>>> end if
>>>> end if
>>>> end if
>>>> end repeat
>>>>
>>>> end MouseUp
>>>
>>> I think that is now it!!!! (I hope)
>>>
>>> Steve
>>>
>>> _______________________________________________
>>> use-revolution mailing list
>>> use-revolution at lists.runrev.com
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>
>>
>> Macintosh PowerBook G-4 OSX 10.3.1, OS 9.2.2, 1.25 GHz, 512MB RAM,
>> Rev 2.1.2
>>
>>
>> Advanced Media Group
>> Thomas J McGrath III ð 2003 ð 3mcgrath at adelphia.net
>> 220 Drake Road, Bethel Park, PA 15102
>>
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
Macintosh PowerBook G-4 OSX 10.3.1, OS 9.2.2, 1.25 GHz, 512MB RAM, Rev
2.1.2
Advanced Media Group
Thomas J McGrath III 2003 3mcgrath at adelphia.net
220 Drake Road, Bethel Park, PA 15102
More information about the use-livecode
mailing list