Yes, I am ready J for C now. But, of course, I understand most if the things.
The main error: I thought that J is like K, but has more features. The problem I found: J vocabulary has much more verbs. Most of the verbs in K is one symbol, in J there are a lot of one-two-three symbol verbs and many special construction. K is much simpler at the point . Sometimes it is hard for me to understand what is it: 1 2 +/@:* 3 4 or 1 2 (+/ @"*) 3 4 or 1 2 (+/@ "*) 3 4. But 5!:2 should help. For example I would write the following example in K: *>|/ and for me it looks easier at the moment. Will try to overwrite it J. Regards, On Fri, Nov 18, 2011 at 11:40 PM, Kip Murray <[email protected]> wrote: > By all means, post questions here. > > And I think you will like J for C programmers (click on JfC at top of > vocabulary page), here is a sample from Chapter 2 Culture Shock: > > Here's an example. Figure out what the following code does: > > int i, j, maxcol = 0; > float maxval = x[0][0]; > for(i = 0;i<=xsize0;++i) { > for(j = 0;j<=xsize1;++j) { > if(x[i][j] > maxval) { > maxval = x[i][j]; > maxcol = j; > } > } > } > > Not too hard. When the code finishes, maxval is the largest element in > the array x, and maxcol is the column number it was in. As it happens, > all I wanted was the column number, but there was no way for you to know > that. > > The same code in J: > > maxcol =. (i. >./) >./ x > > With some practice, you will learn to read this code just as easily as > you read the C. You will recognize the / as an indicator of a loop that > accumulates a result, and the i. as an indicator of a search. The =. > and =: tokens indicate assignment. > > What happened to the if statement? > > It's built into the >. primitive. Just as most loops are hidden inside > primitives, so are most conditionals. The functions you write can also > contain built-in conditionals. > > What's the statement delimiter? > > There isn't one. Statements are exactly one line long. > > I've looked at some J code. Every other character is a period or a > colon. I've got spots before my eyes. How can anybody read this stuff? > > . . . > > > On 11/18/2011 3:45 PM, Raul Miller wrote: >> If you cannot find the right reference material, then just post questions >> here. >> >> We have a "J for C Programmers" book, but we do not have a "J for K >> Programmers". And in some ways, J is more complicated to use than K. (K >> tends to be simpler for 1 dimensional data and for tree structures.) >> > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Regards, Alexander. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
