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

Reply via email to