Since x m&u y is m&u^:x y, x [EMAIL PROTECTED]&0 y is u^:x y.
Moreover, g0`g1`...`gn/y is (0{y) g0 (1{y) g1 (2{y) ...
Therefore,
u0=: 1&+
u1=: +%:@|
([EMAIL PROTECTED]&0)`([EMAIL PROTECTED]&0)/ 2 3 5
15.0766
u0^:2 u1^:3 ]5
15.0766
In general, you have to do
> ([EMAIL PROTECTED]&0&.>)`([EMAIL PROTECTED]&0&.>)`...`([EMAIL
PROTECTED]&0&.>)/(<"0 i),<y
----- Original Message -----
From: "R.E. Boss" <[EMAIL PROTECTED]>
Date: Thursday, January 24, 2008 13:13
Subject: [Jprogramming] Powers of verbs
To: 'Programming forum' <[email protected]>
> 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.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm