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<[email protected]>  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




_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to