> Da: Raul Miller <[email protected]>

> > Basically, an element in B percolates (via a sum) to all the elements whose
> > depth (indicated by A) is greater than its own depth.
> 
> This, combined with the task description sounds like:
> 
>    B+B+/ .*1=+/\~:/\inv </~A
> 14 30 22 44 49 52 50 79 79 114 51 50 47 64 72 75 112 95 53 68 112 219 72
> 
> > This applies only to the last-so-far of the elements at that depth.
> 
> I do not understand this exception.

I hope Mr. Boss isn't bothered by my intrusion. I'll try and explain one way I 
see this problem. It could very well be that in Mr. Boss' mind the specs are 
completely different, but I do believe that the formulation is equivalent.
Let's think of a family, only men, with fathers, children, grandchildren, 
grandfathers and so on. Each father can have several kids, but a kid can only 
have one father. Each one of the members of this family has numeric mark which 
he passes on to all his kids, so that the kids have their own number plus that 
of their father.
The family father son relationship is represented by a vector A and the 
non-inherited numeric mark by a vector B. Vector C will be the actual numeric 
mark, taking into account all the marks inherited by the father, the 
grandfather, the grandgrandfather and so on. Notice that, as I stated, anyone 
can have an arbitrary number of kids. This means that the line that goes from 
himself to his greatancestor, the famed progenitor, can only reach one person 
per generation. 
The representation of the family tree is quite straightforward: in vector A we 
record the depth, that is, the distance in generations from the great 
progenitor. Somebody at generation n+1 is, by definition, the child of the 
first generation n at his left in vector A.
Example. Let's say Arthur was the great progenitor. He had 3 kids, Bart, Ben 
and Baz.
In this case:
        A=.0 1 1 1
where 0 represents Arthur, the first 1 Bart, the second 1 Ben and the third Baz.
Now when Ben becomes a father, where do we put his kid Calvin? Right after him!
So:
        A=.0 1 1 2 1
where the 2 is after the second 1 because Calvin is not Bart's nor Baz's child, 
but Ben.
Let's add two more kids: Daniel is Calvin's firstborn, and Carl who is Baz's 
kid.
Now:
        A=.0 1 1 2 3 1 2
You can see the 3 for Daniel inserted between his father (the first 2) and his 
uncle Baz (the last 1). And you can see the last 2 for Carl, Baz's offspring.

Now let's say Arthur had as his mark number 3, Bart 9, Ben 2, Baz 7, Calvin 12, 
Carl 15, Daniel 20.
So:
        B=.3 9 2 12 20 7 15

Let's pick Carl: what his is actual mark number? He was born with 15, inherited 
7 from his father Baz and 3 from his grandfather Arthur. In total: 15 + 7 + 3=25
So:
        C=.? ? ? ?  ?  ? 25

How about Daniel? Daniel is a 20, his father Calvin 12 and so on...

I hope it's clearer now.
--
Stefano


---
-- 
WildHeart'2k (on the web)

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to