This manual has been around for many years now.
I guess most of us reading it did not bother to test if the C code worked or
not.
I even translated this book over to Islandish and just copied the C without
testing.
As the books goes on it is less and less C in it but quite a lot of good
explanations of what J is all about.
What you will find is that there are many ways to skin a cat.
You can more or less imitate C source code directly in J or you can go all
the way and imitate compiled code.
Very often there are easy utilities available that have solved problems and
you can use the utilities or use them as examples and use them as ideas for
your own further use.

2011/1/25 Ron Jeffries <[email protected]>

> Hi. I'm Ron Jeffries. I've been experimenting with J language with
> advice from Tracy Harms, Raul Miller, Henry Rich, and Gilles
> Kirouac. (Thanks to you all, and to anyone I've missed.)
>
> Gilles, in particular, detected that I may have dived in too deep,
> and suggested that I go back to J for C programmers and work through
> that. I had started with it but didn't really find it tasty, but on
> his advice I'm going again.
>
> I noticed in an early example, the accounts one, this patch of C code:
>
>  while(3 == fscanf(fid,"%f%f%f",acctno,xactnday,xactnamt) {
>     for(acctx = 0;acct[acctx].ano != acctno;++acctx);
>     acct[nacct].weightbal +=
>        acct[nacct].currbal * (xactnday - acct[nacct].prevday);
>     acct[nacct].currbal += xactnamt;
>     acct[nacct].prevday = xactnday;
>  }
>
> A similar patch appears at the end of the example.
>
> I'm quite rusty on C but it appears to me that the for loop finds
> the value of acctx such that we have the right account number acctno
> ... but that the subsequent code updates account number nacct,
> which, as the incremented value of nacct after the input read loop,
> is in fact an uninitialized account struct.
>
> Am I missing something? If not, maybe the example in JfC needs
> updating. If nothing else, this surely shows that J is not subject
> to this kind of error, or at least not quite so easily.
>
> I'm sure I'll be back with beginner J questions soon. Thanks!
>
> Ron Jeffries
> www.XProgramming.com
> If not now, when?  -- The Talmud
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Björn Helgason, Verkfræðingur
Fornustekkum II
781 Hornafirði,
t-póst: [email protected]
gsm: +3546985532
sími: +3544781286
http://groups.google.com/group/J-Programming


Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans

góður kennari getur stigið á tær án þess að glansinn fari af skónum
          /|_      .-----------------------------------.
         ,'  .\  /  | Með léttri lund verður        |
     ,--'    _,'   | Dagurinn í dag                     |
    /       /       | Enn betri en gærdagurinn  |
   (   -.  |        `-----------------------------------'
   |     ) |         (\_ _/)
  (`-.  '--.)       (='.'=)   ♖♘♗♕♔♙
   `. )----'        (")_(") ☃☠
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to