If you do not mind using proverbs then you could also code as follows,
pov=: 4 : ' '']'',~ , x ([,'' '',~])&> (''^:''<@,"1 ]) ":,. y'
(('(1&+)';'(+%:@|)') pov 2 3) ,&.": 5
15.0766274
u0=. 1&+
u1=. +%:@|
(u0`u1 pov 2 3) ,&.": 5
15.0766274
----- Original Message ----
From: R.E. Boss <[EMAIL PROTECTED]>
Thanks to all who responded.
One of the solutions I had was the same as Hodgkinson, be it with a
for-loop.
The second solution of Miller I liked most, for its elegance.
Since I don't like the lengthy solutions (with #), I think I stick to the
straightforward
(('(1&+)';'(+%:@|)') pov 2 3) ,&.": 5
15.076627
with
('(1&+)';'(+%:@|)') pov 2 3
(1&+)^:2 (+%:@|)^:3]
and
pov=: 4 : ' '']'',~ , x ,&> (''^:''<@,"1 ]) ":,. y'
R.E. Boss
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] [mailto:programming-
> [EMAIL PROTECTED] Namens Andrew Nikitin
> Verzonden: vrijdag 25 januari 2008 16:43
> Aan: [email protected]
> Onderwerp: [Jprogramming] Powers of verbs
>
>
> 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_01200
> 8----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm