Re: Help with an algorithm...

2019-08-05 Thread Mark Wieder via use-livecode
On 8/5/19 3:20 PM, dsc--- via use-livecode wrote: Children are sub-arrays of parents. Ain't that the truth. -- Mark Wieder ahsoftw...@gmail.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe,

Re: Help with an algorithm...

2019-08-05 Thread dsc--- via use-livecode
I fixed this to use lists... Maybe. put parentArray( LISTNEW ) into aNew put parentArray( LISTOLD ) into aOld intersect aNew with aOld -- Remove from aOld that which is not in aNew union aOld with aNew recursively -- Leaves aNew unchanged except that children in aOld are brought in. I think.

Re: Help with an algorithm...

2019-08-05 Thread Dar Scott Consulting via use-livecode
I know this does not attend to the question, but my feelings are like this: if one has control, go back and use arrays from the start. Now, to your comments on robustness in parsing the files. I suppose any whitespace at the start of a line could be considered a child. Also, it is an error if

Re: Help with an algorithm...

2019-08-05 Thread dunbarxx via use-livecode
Hmmm. I had mentioned earlier: "You cannot just find matching lines between the two lists, because some children AND some parents may be present in both... The discussion has focused on array lore, and that is fine, but are we all in agreement that the main task is to isolate the parents,

Re: Help with an algorithm...

2019-08-05 Thread Dar Scott Consulting via use-livecode
My mistake. I was thinking arrays. > On Aug 5, 2019, at 3:34 PM, Mark Wieder via use-livecode > wrote: > > On 8/5/19 2:24 PM, Dar Scott Consulting via use-livecode wrote: >> Yikes! I wasn't aware of duplicate keys being a problem. How does that >> happen? > > Marx > Groucho > Chico > etc. >

Re: Help with an algorithm...

2019-08-05 Thread Mark Wieder via use-livecode
On 8/5/19 2:24 PM, Dar Scott Consulting via use-livecode wrote: Yikes! I wasn't aware of duplicate keys being a problem. How does that happen? Marx Groucho Chico etc. Marx Karl etc. -- Mark Wieder ahsoftw...@gmail.com ___ use-livecode mailing

Re: Help with an algorithm...

2019-08-05 Thread Dar Scott Consulting via use-livecode
Yikes! I wasn't aware of duplicate keys being a problem. How does that happen? > On Aug 5, 2019, at 2:28 PM, Alex Tweedly via use-livecode > wrote: > > I'm a great fan of, and user of, arrays - but we always need to be careful of > losing data with duplicated keys. > > You haven't said that

Re: Help with an algorithm...

2019-08-05 Thread Alex Tweedly via use-livecode
I'm a great fan of, and user of, arrays - but we always need to be careful of losing data with duplicated keys. You haven't said that the parent names in LISTNEW are guaranteed to be unique. This simple code assumes they are - if they're not, it's easy to add a check ...  (And it also assumes

SOLVED: Help with an algorithm...

2019-08-05 Thread Paul Dupuis via use-livecode
On 8/5/2019 11:53 AM, Paul Dupuis via use-livecode wrote: Today is not my coding day. I have a problem I should be able to design a solution for an am struggling. Clearly I am missing "something" I have 2 lists (LISTNEW and LISTOLD) of the following format: ParentA Child 1 Child 2 etc.

Re: Help with an algorithm...

2019-08-05 Thread Dar Scott Consulting via use-livecode
I'm pretty sure I goofed somewhere, but maybe something like this? intersect ARRAYNEW with ARRAYOLD into temp union temp with ARRAYNEW recursively > On Aug 5, 2019, at 9:53 AM, Paul Dupuis via use-livecode > wrote: > > Today is not my coding day. I have a problem I should be able to design a

use-list formatting (was Re: Help with an algorithm...)

2019-08-05 Thread Dar Scott Consulting via use-livecode
I agree that the lack of formatting makes it hard to communicate. I would favor changing the list settings to allow for it. I don't think we have a spam problem that would discourage that. And to help support this, LC copy should include types easily pasted into mail clients. > On Aug 5,

Re: Help with an algorithm...

2019-08-05 Thread dunbarxx via use-livecode
I saw your post preceded my second one. Besides the fact that this works as well and is faster: repeat for each line tLine in tAll put tLine into myArray[ tLine] end repeat The array thing is the easy part. The real working of this gadget depends on being able to isolate the

Re: Help with an algorithm...

2019-08-05 Thread Dar Scott Consulting via use-livecode
I'd tend to look for ways to do this with functions that work on whole collections and avoid loops. If that is not found, or is hard to work with, I'd change the lists to be arrays. Each array is is keyed by parents. Each parent is an array of children. Children can be represented as an

Re: Help with an algorithm...

2019-08-05 Thread dunbarxx via use-livecode
I really do not like the use-list. It is difficult to format one's answers. Here is a handler that places a few pieces of data into two variables. These would be the two isolated lists of children derived from the parents as described earlier. There is one difference between the two lists, the

Re: Help with an algorithm...

2019-08-05 Thread Paul Dupuis via use-livecode
s via use-livecode To: How to use LiveCode Cc: Paul Dupuis Sent: Mon, Aug 5, 2019 11:53 am Subject: Help with an algorithm... Today is not my coding day. I have a problem I should be able to design a solution for an am struggling. Clearly I am missing "something" I have 2 lists (LISTNEW a

Re: Help with an algorithm...

2019-08-05 Thread dunbarx--- via use-livecode
This way the last item can be isolated directly. Craig -Original Message- From: Paul Dupuis via use-livecode To: How to use LiveCode Cc: Paul Dupuis Sent: Mon, Aug 5, 2019 11:53 am Subject: Help with an algorithm... Today is not my coding day. I have a problem I should be able to

Help with an algorithm...

2019-08-05 Thread Paul Dupuis via use-livecode
Today is not my coding day. I have a problem I should be able to design a solution for an am struggling. Clearly I am missing "something" I have 2 lists (LISTNEW and LISTOLD) of the following format: ParentA Child 1 Child 2 etc. ParentB Child 1 etc. etc. The parents are in alphabetical sorted