Here's what I have (watch for long lines; there are only 2
executable lines):

NB. Conjunction.  Apply u at the cell indicated by n
applyintree =: 2 : 0
if. #n do. ((u applyintree (}.n)) L:_1 ({.n){y) ({.n)} y else. u y end.
:
NB. The rank is s,0 where s is the surplus of x-rank over y-rank.  This causes
NB. the cells of y to be matched up with the largest appropriate blocks x.  This
NB. is necessary because it is impossible to change the shape of the values 
being modified
if. #n do. (x u applyintree (}.n) L:_ _1"(0 (,~ >.) x -&([EMAIL PROTECTED]) a) 
(a =. ({.n){y)) ({.n)} y
else. x u y end.
) 


Example use:

fnx =. >: applyintree (0;2) x  NB. Increment state

[ applyintree n   would replace.

Henry Rich

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Pascal Jasmin
> Sent: Friday, October 27, 2006 10:14 PM
> To: Programming forum
> Subject: [Jprogramming] updating tree -- equivalent to what 
> }:: would do
> 
> Does anyone have code to update a tree? using the {:: and < 
> S: 1 {:: index formats?
> 
>    for example:
>    last10dig=: (/:~ @ (("."0":)  @ (1000000000x &|)))
>    < S: 1 {::  ] 5!:2 <'last10dig'
> 
> Are there plans to implement }:: similarly to }?
> 
> 
> 
> ----------------------------------------------------------------------
> For information about J forums see 
> http://www.jsoftware.com/forums.htm

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

Reply via email to