Help me with my inability to see a simple solution
Alex Tweedly
alex at tweedly.net
Fri Dec 17 03:47:41 EST 2010
On 17/12/2010 00:59, william humphrey wrote:
> Thanks Alex - tested working also.
>
Only because our test data isn't hard enough :-)
It should have
> repeat with i = N+1 to pMax
> put i & comma after tMissingList
> end repeat
inserted immediately before the return statement, to cover the case
where the missing numbers are at the end of the expected range.
-- Alex.
> On Thu, Dec 16, 2010 at 8:48 PM, Alex Tweedly<alex at tweedly.net> wrote:
>
>> function other pMin, pMax, pList
>>> put empty into tMissingList
>>> put empty into tDuplicateList
>>>
>>> -- sort the data if needed
>>> -- sort items of pList ascending numeric
>>>
>>> put pMin-1 into tLast
>>> repeat for each item N in pList
>>> if N = tLast+1 then
>>> put N into tLast
>>> next repeat
>>> end if
>>> if N = tLast then
>>> put N& comma after tDuplicateList
>>> next repeat
>>> end if
>>> repeat with i = tLast+1 to N-1
>>>
>>> put i& comma after tMissingList
>>> end repeat
>>> put N into tLast
>>>
>>> end repeat
>>> return (char 1 to -2 of tMIssingList)&cr& \
>>> (char 1 to -2 of tDuplicateList)
>>> end other
>>
>
More information about the use-livecode
mailing list