I will have a look at these suggestions, especially the 8!: foreigns reference.
Yes, working through a single problem keeps your interest and leads you down many roads; I think I will work through some more simple problems once I have finished all the ideas presented in this single thread. I am hooked on J! Rob On Mon, May 27, 2013 at 8:03 AM, Raul Miller <[email protected]> wrote: > On Sun, May 26, 2013 at 2:54 PM, Robert Herman <[email protected]> > wrote: > > My reference to Perl's output was of the solutions printed on the count > > lines such as this: > > > > 1: 2 27 28 > > 2: 3 26 28 > > 3: 4 25 28 > > ..... > > > > 60: 17 19 21 > > 61: 18 19 20 > > Total 61 > > > I see that you have already been given an answer, but here's how I > would approach this: > > T=: 3 :0 NB. format answer > n=. ": ,.1+i.# y > tri=. ": ($ #: I.@,) y > (n,':',' ',tri), 'Total ',":#y > ) > > You could also play with the 8!: foreigns if you wanted something > approaching some of perl's formatting mechanisms. > > > Raul, thank you so much for your other pointers on inspecting the > arrays. I > > will have two more days after work going over all of that. It's amazing > how > > working through this seemingly simple problem with your help has taught > me > > more about J than the hours I spent just doing single bits from the J > > dictionary. What would be the best J book to go through the vocabulary in > > problem sets such as this? Rosetta code? J for C programmers? > > I have nothing against talking about issues (when I have time, > anyways). The problem with written material is that it's often aimed > at contexts other than the ones you are currently interested in. And, > interest is one of the most valuable learning aids, ever, as are > examples relevant to your interests. > > That said, J for C programmers, is a good book, as are other books > available from the jsoftware site. Similarly, if you are interested in > the examples at Rosetta code, most of that code is valid (some might > have issues where it assumes a specific version of J or specific OS > facilities - and this is not only an issue with J examples). > > The J labs can also be good for learning. > > Thanks, > > -- > Raul > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
