OK. I get it: "... so that repeated occurence of an
index will produce another function application."

In this particular case also

   3 5 3 (+/@(=/) ^&2"0 ]) i.10
0 1 2 81 4 25 6 7 8 9

In general,

   a=. 1 : '+/@(=/) [EMAIL PROTECTED]:["0 ]'
   ^&2 a
+/@(=/) ^&[EMAIL PROTECTED]:["0 ]
   3 5 3 ^&2 a i.10
0 1 2 81 4 25 6 7 8 9


Nice trick with the gerund trains by Dan Bron though.


----- Original Message ----
From: Oleg Kobchenko <[EMAIL PROTECTED]>
To: Programming forum <[email protected]>
Sent: Saturday, November 25, 2006 10:40:26 PM
Subject: Re: [Jprogramming] Index replacement


Could the requirements be explained again:
how we get from i.10
    0 1 2 3 4 5 6 7 8 9
to
    0 1 2 81 4 25 6 7 8 9
using 3 5 3?

Like this?

   a^1>.+:+/3 5 3=/a=.i.10
0 1 2 81 4 25 6 7 8 9


----- Original Message ----
From: JC Coez <[EMAIL PROTECTED]>
To: Programming forum <[email protected]>
Sent: Friday, November 24, 2006 2:08:48 PM
Subject: [Jprogramming] Index replacement


How could I apply a function f to elements of an array which are selected by 
a given list, those elements could be modified several times.
For example if f is 2^ and v =:  i.10 and ind=: 3 5 3 the result would  be 
0 1 2 81 4 25 6 7 8 9
I don't find any simple solution.
Thanks for any help
Jen Claude Coez 

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



____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


 
____________________________________________________________________________________
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to