p=: 2 : 0
NB. Apply u[n ... 2 1 0] to power v[n ... 2 1 0] to arg y
NB. Assumes u is a list of gerunds, and v powers (same length)
i=:#v
while. 0 <: i=.i-1
do.
   y=.((i{u)`:0)^:(i{v) y
end.
y
)

This just shows the model and is not pretty, but produces your answer.

   (1&+)`(+%:@|) p 2 3[5
15.0766

I am keen to see if/how a tacit/non-looping version can be done.../Rob


On 25/1/08 8:13 AM, "R.E. Boss" <[EMAIL PROTECTED]> wrote:

> Given a sequence of verbs, say  u0, u1, u2, ...  and a row of integers, say
> i0, i1, i2, .... 
> How does one achieve
> 
>    ... u2^:i2 u1^:i1 u0^:i0 y  ?
> 
> Example:
> let  (1&+)`(+%:@|)  be u1 and u0
> and  2 3  be i1 and i0
> 
>    (1&+)^:2 (+%:@|)^:3 [5
> 15.076627
> 
> is the desired result.
> 
> 
> R.E. Boss
> 
> 
> 
> ----------------------------------------------------------------------
> 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