On Wed, Nov 24, 2010 at 10:48 AM, Zsbán Ambrus <[email protected]> wrote:
> On Tue, Nov 23, 2010 at 11:05 PM, Justin Paston-Cooper
> <[email protected]> wrote:
>> What is a common phrase for replacing element n in an array a by
>> itself applied to a monad m?
>
> This question seems to come up very often in the forums and on irc.

Well... here is what I would think is a natural approach to solving
a general case of this problem:

power=:1 :0
:
   x u 1 :(':';'u^:x y')"(-#$x) y
)

Note also that this might be an example of a case where the
proposals about an alternate implementation for u"v could
make things simpler.

Example use:
   1 0 1 *:power i.3 3
 0  1  4
 3  4  5
36 49 64
   ((e. p:@,) *: power ]) i.3 3
0  1  4
9  4 25
6 49  8

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to