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

Reply via email to