Help me with my inability to see a simple solution

william humphrey bill at bluewatermaritime.com
Fri Dec 17 08:17:35 EST 2010


But the data never produces missing numbers at the end.  That would only
happen if there was some maximum number it was supposed to reach, instead it
is the last number entered that is the last number. There could be a last
number that is a duplicate but I will certainly add your correction. I went
through and looked at past voyages (each has over two hundred data sets of
shipping bill of ladings) and found some errors. Those kind of errors are
very difficult to see by any other method.

On Fri, Dec 17, 2010 at 4:47 AM, Alex Tweedly <alex at tweedly.net> wrote:

> 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
>>>>
>>>
>>>
>>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
http://www.bluewatermaritime.com



More information about the use-livecode mailing list