Hi Ric, I have to admit that I'm new to this type of programming with J so please be patient with my questions. 1. I initially tried doing a tacit definition of cmp0=: I. 0 = |syntax error | cmp0=: I.0= So why does the following script not fail anymore (although it doesn't work)? cmp0=: I. 0 =,
2. M is 2 dimension matrix. The result of ([: I. 0 = ,@]) is 6 and 8. The code proceeded to amend the data as if it was a vector!!! If I try to do that manually, I'll get errors. Why? I've always thought that in a 2 dimension matrix, I need to provide the row and column position for amends _ 6} M |domain error | _&6}M _ (6}) M |length error | _ 6}M _& (6}) M |index error | _ (6})M _ 6} M |index error | _&(6})M _ (6)} M |length error | _ 6}M _ (6)} M |index error | _ (6)}M 3. This is the first time I use [: symbol. I looked it up in the help file and my brains threw a breaker after reading this : "For example, 5(+*-)3 is (5+3)*(5-3). If f is a cap ([:) the capped branch simplifies the forks to g h y and g x h y . The train N g h (a noun followed by two verbs) is equivalent to N"_ g h . The ranks of the hook and fork are infinite." I would appreciate it if somebody can provide a better explanation ... please. :) Thanks. r/Alex -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sherlock, Ric Sent: Thursday, September 18, 2008 5:20 PM To: Programming forum Subject: [Jprogramming] RE: Applying Amend on each row ---Alex Rufon wrote: > What I want to do is to replace all zero in the matrix with infinity. ]M=: 4 [EMAIL PROTECTED] 6 5 9 2 4 9 0 7 0 4 6 8 3 8 1 2 amendZeros=: _&(([: I. 0 = ,@])}) amendZeros M 6 5 9 2 4 9 _ 7 _ 4 6 8 3 8 1 2 Check out Chapter 6.3.3 Linear Indices in Learning J ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
