Re: Help me with my inability to see a simple solution

2010-12-26 Thread Nonsanity
Doing a numeric sort before processing would solve it on the LC side. ~ Chris Innanen ~ Nonsanity On Sun, Dec 26, 2010 at 1:54 PM, william humphrey < b...@bluewatermaritime.com> wrote: > I fixed it by checking to make sure every number was formatted as three > characters first. It's funny wha

Re: Help me with my inability to see a simple solution

2010-12-26 Thread william humphrey
I fixed it by checking to make sure every number was formatted as three characters first. It's funny what you don't see... On Sun, Dec 26, 2010 at 2:34 PM, william humphrey < b...@bluewatermaritime.com> wrote: > I just found out that the number set: > > (001,002,003,005,006,007,008,009,5,6) > > w

Re: Help me with my inability to see a simple solution

2010-12-26 Thread william humphrey
I just found out that the number set: (001,002,003,005,006,007,008,009,5,6) wrecks most of the solutions. It was because SQL was sorting a way that included the zeros in the sort so the sort would come out looking like the above. I didn't notice what was causing the problem until I scrolled way

Re: Help me with my inability to see a simple solution

2010-12-22 Thread william humphrey
Ken that is too easy and simple. Even I can understand it at a glance. Can't possibly work. Thanks everyone for lots of excellent answers! ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and mana

Re: Help me with my inability to see a simple solution

2010-12-22 Thread Nonsanity
That's a very clean and simple solution, Ken. I've enjoyed looking at all the methods people have used for this simple task. I'd go with yours if speed wasn't an issue - that is, the lengths of data were about as long as the sample and not a megabyte or more of the stuff. I wrote mine with speed i

Re: Help me with my inability to see a simple solution

2010-12-21 Thread Ken Ray
I know I'm kind of late, but here's another way to accomplish the same thing (it's also a bit shorter): on mouseUp put "3,4,5,6,6,7,8,9,10,12,13,13,14" into tData put MissingAndDupes(tData) into tResult -- line 1 of tResult will be empty or have a list of missing numbers -- line 2 of tResu

Re: Help me with my inability to see a simple solution

2010-12-17 Thread william humphrey
That's exactly what I did. A day doesn't go by that I find another way to make a mistake. Thanks for all your help. On Fri, Dec 17, 2010 at 3:00 PM, Robert Brenstein wrote: > On 16.12.2010 at 20:36 Uhr -0400 william humphrey apparently wrote: > >> function getMissingNumbers pNumberList >> put

Re: Help me with my inability to see a simple solution

2010-12-17 Thread Robert Brenstein
On 16.12.2010 at 20:36 Uhr -0400 william humphrey apparently wrote: function getMissingNumbers pNumberList put empty into vOccurences repeat for each item vNumber in pNumberList add 1 to vOccurences[vNumber] end repeat get the keys of vOccurences sort lines of it numeric put line -1 of i

Re: Help me with my inability to see a simple solution

2010-12-17 Thread william humphrey
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

Re: Help me with my inability to see a simple solution

2010-12-17 Thread Alex Tweedly
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 wher

Re: Help me with my inability to see a simple solution

2010-12-16 Thread Nonsanity
My bad... Didn't cover the case of several numbers in a row missing from the middle of the sequence. This fixes that. function CheckList src sort items of src numeric put "," into dups put "" into miss repeat with a = 1 to item 1 of src - 1 put a & "," after miss end

Re: Help me with my inability to see a simple solution

2010-12-16 Thread Nonsanity
What the heck, I'll make one too. :) function CheckList src sort items of src numeric put "," into dups put "," into miss repeat with a = 1 to item 1 of src - 1 put a & "," after miss end repeat repeat with a = 1 to the number of items in src - 1 if item

Re: Help me with my inability to see a simple solution

2010-12-16 Thread william humphrey
Thanks Alex - tested working also. On Thu, Dec 16, 2010 at 8:48 PM, Alex Tweedly 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

Re: Help me with my inability to see a simple solution

2010-12-16 Thread Alex Tweedly
Depends on whether the data is known to be already in order. If not, then you need to uncomment the sort command. btw. sorry, this doesn't use arrays, but it will be much faster than the array method(s) if the data set is large. function other pMin, pMax, pList put empty into tMissingLi

Re: Help me with my inability to see a simple solution

2010-12-16 Thread william humphrey
Thanks Terry. This solved my problem! On Thu, Dec 16, 2010 at 8:03 PM, Terry Judd wrote: > pMin is your minimum value > pMax is your maximum value > pList is your list of numbers to test > The output is a list of missing numbers (line 1) and repeat numbers (line > 2) > > function stuff pMin, pMa

Re: Help me with my inability to see a simple solution

2010-12-16 Thread william humphrey
function getMissingNumbers pNumberList put empty into vOccurences repeat for each item vNumber in pNumberList add 1 to vOccurences[vNumber] end repeat get the keys of vOccurences sort lines of it numeric put line -1 of it into vLargestNumber put empty into vMissing repeat with i=1 to vLa

Re: Help me with my inability to see a simple solution

2010-12-16 Thread Robert Brenstein
On 16.12.2010 at 19:29 Uhr -0400 william humphrey apparently wrote: My math skills are terrible but this is something I can do in excel but which should also be easy to do with a nested array in livecode. I want to build a function that returns the numbers that are out of sequence in a list of nu

Re: Help me with my inability to see a simple solution

2010-12-16 Thread Terry Judd
On 17/12/10 10:29 AM, "william humphrey" wrote: > My math skills are terrible but this is something I can do in excel but > which should also be easy to do with a nested array in livecode. I want to > build a function that returns the numbers that are out of sequence in a list > of numbers. Say y