Weekend challenge

J. Landman Gay jacque at hyperactivesw.com
Tue Jul 2 23:28:26 EDT 2013


On 7/2/13 3:42 AM, Geoff Canyon wrote:
> I'd be very curious to know what the rails code looked like.

They basically ended up with something very similar to what I did, but I 
don't have their code. They said it was like this:

look at a line and store the ID in a variable
look at that line + 1
    if the ID is the same, keep going
    if the ID is different, look at line + 2
      if line+2 is the old ID, then line+1 is out of order
      if line+2 is the same as line+1, it's a new block
        put the new ID into the stored variable

That was what I ended up with too for sequencing checks. Then they said 
something about "automatic duplicate checking" which Rails has and we 
don't. I had enough repeat loops to make me dizzy. Your one-pass script 
was better.

> The unique requirement on the  type might be (assuming the data has
> been processed to 6-item comma-delimited lines):
>
> put the indexes of lines of myList where the count of item 4 of each
> > 1 into myDupedTypes
>
>
> For the requirement across the ID, section, and subsection, and type,
> not counting the type when it dupes its parent subsection, maybe:
>
> put the indexes of lines of myList where item 1 of each is among the
> items of item 2 to 4 of any into myDupedIDs
>

I asked a while back if I could just lift out the keys of sub-arrays 
from a big array without looping through them all, but nope. Your 
suggestions would have been useful too.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list