Your explicit form is nothing to be ashamed of.  It's
better than lots of gerunds and boxing.

Taking advantage of your precise problem, you could write

list_b =. list_b , list_b (+/%#)@(index_b&{)@[^:(0 = ]) index_a { list_a

Just make sure you DON'T write

list_b =. list_b ([ , (+/%#)@(index_b&{)@[^:(0 = ])) index_a { list_a

because that would lose the in-place append.

Henry Rich

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Robert O'Boyle
> Sent: Friday, March 28, 2008 11:52 AM
> To: [email protected]
> Subject: [Jprogramming] gerunds and looping through matrices
> 
> I have struggled with a problem lately that the forum might 
> be able to help
> me with. 
> 
>  
> 
> Here is the script within a bigger explicitly defined verb in 
> which I am
> using the IF control structure
> 
>  
> 
> if. (index_a { list_a) = 0
> 
> do. 
> 
> list_b =. list_b, (+/%#) index_b { list_b
> 
> else. 
> 
> list_b =. list_b, index_a { list_a
> 
> end.
> 
>  
> 
> To paraphrase, I have a list_b of which I want to estimate 
> the last value. I
> check an indexed value in another list_a to see if it is 0 or 
> not. If 0, the
> last value of list_b becomes a mean (based on yet another set 
> of indices,
> index_b) of some values within list_b. If not 0, the last 
> value of list_b
> becomes the value from list_a that I checked to see whether 
> or not it was 0.
> 
> 
>  
> 
> I was trying to use a gerund with two verbs for each choice 
> but got stumped
> on the nouns. There is obviously more here than one x and one y term.
> Perhaps this is a more general question. When one has more 
> that an x and y
> term, how can multiple nouns be used in gerunds and agendas? 
> Or perhaps this
> is the entirely wrong approach.
> 
>  
> 
> Bob
> 
> ----------------------------------------------------------------------
> 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