Alternatively, if powers are not too big and all non-negative you can construct 
a train and execute it. Something like
   u0=.>:
   u1=:+:
   u2=:*:
   g=.({: ,~ ({. [:`[:) ,@,. }:) 3 4 5#u0`u1`u2
   g `:6
[: u0 [: u0 [: u0 [: u1 [: u1 [: u1 [: u1 [: u2 [: u2 [: u2 [: u2 u2
   (g `: 6) 1
19


----- Original Message -----
From: "R.E. Boss" 
Date: Thursday, January 24, 2008 13:13
Subject: [Jprogramming] Powers of verbs
To: 'Programming forum' 

> 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.



_________________________________________________________________
Connect and share in new ways with Windows Live.
http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to