[m=: ?.4 4$ 10
6 5 9 2
4 9 0 7
0 4 6 8
3 8 1 2
   2 ((+:@{)`[`])}"1 m
6 5 18 2
4 9  0 7
0 4 12 8
3 8  2 2

On Mon, 8 May 2006, R.E. Boss wrote:

+    [m=: ?.4 4$ 10
+ 6 5 9 2
+ 4 9 0 7
+ 0 4 6 8
+ 3 8 1 2
+    2 ((+:@{)`[`])} &.|: m
+ 6 5 18 2
+ 4 9  0 7
+ 0 4 12 8
+ 3 8  2 2
+
+
+ R.E. Boss
+
+ -----Oorspronkelijk bericht-----
+ Van: [EMAIL PROTECTED]
+ [mailto:[EMAIL PROTECTED] Namens June Kim
+ Verzonden: maandag 8 mei 2006 11:39
+ Aan: Programming forum
+ Onderwerp: [Jprogramming] Amend Column with Verb
+
+ Hello
+
+ Suppose there is a 2d matrix m(sized as row, col) and a verb f. What I
+ want is the elements at column c are replaced with the result of f c,
+ that is each element is replaced with its result of f. The result
+ should be the same shape of m, only the column amended.
+
+ For example,
+    m=: ?4 4$ 10
+    m
+ 0 6 3 2
+ 9 1 7 3
+ 5 2 9 5
+ 4 0 9 0
+    f=:+:
+    (f amendcol 2) m
+ 0 6 6 2
+ 9 1 14 3
+ 5 2 18 5
+ 4 0 18 0
+
+ What is the easiest way? BTW, it doesn't have to follow the form of
+ the former example; it's just to convey the concept.
+
+ June
+ ----------------------------------------------------------------------
+ For information about J forums see http://www.jsoftware.com/forums.htm
+
+ ----------------------------------------------------------------------
+ For information about J forums see http://www.jsoftware.com/forums.htm
+

(B=) <----------my "sig"

Brian Schott
Atlanta, GA, USA
schott DOT bee are eye eh en AT gee em ae eye el DOT com
http://schott.selfip.net/~brian/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to