I have read a bunch of the J for C programmers book as well as the primer, dictionary,ect. I truly don't intend to write major programs in J. I am doing this for a class assignment. I am comparing J to C because I have to teach it to a class of people who only know C. I wanted to be able to show analogies. I know that J is strong on array handling, and I am slowly learning that it isn't meant for user input. For my assignment I need to Accept up to 30 values from the keyboard for each of two variables and then compute: number of entries, minimum value, max, range, mean, variance, standard deviation. I know how to do those tasks on the command line in J, but my professor is big on user prompts. He doesn't want to see a program written for programmers. He wants a user friendly program for people who don't know the language.
On 4/13/07, Dan Bron <[EMAIL PROTECTED]> wrote:
Amelia, I believe you picked this read/evaluate/print/loop (REPL) problem because you perceive it to be the trivial, standard, "hello world!" program, and you're used to using it to learn new programming languages. I'm here to tell you that this is NOT the way to learn J, and neither is REPL a trivial program in J. The verb you quote below isn't J. It's C, pretending to be J. If I'm wrong, and your goal truly is to write REPL programs, then I suggest you choose a different programming language. But if I'm right, and you're just trying to learn J, then I suggest you choose a different problem. J is an array oriented language. It is happiest when it can work on a bunch of data at once. It doesn't work (well) on streams, it works (heroically) on blocks (aka files). So your toy J program should really get its input from files, not user interaction. As I suggested yesterday, you'll find Henry Rich's "J for C Programmers" enlightening and entertaining. You'll get a lot of value out of it. It's available here: http://www.jsoftware.com/help/jforc/contents.htm if you want to read it offline, it's already on your system. In the J window, press the F1 key. That'll open the J documenation in your browser. At the top of the page, you'll see a list of links: click on the one entitled JfC . Alternatively, if you want to read JfC on paper (truly offline), you can download a PDF or the original word document: PDF: http://www.jsoftware.com/jwiki/HenryRich?action=AttachFile&do=get&target=JforC20060721.pdf Word: http://www.jsoftware.com/jwiki/HenryRich?action=AttachFile&do=get&target=JforC20060720.doc and print it out. If a whole book is intimidating, then try the nice, brief, J Primer: http://www.jsoftware.com/help/primer/start_here.htm press the >> link to go from page to page. The primer is also on your system, it's the entitled Pri in that list of links. Subsequent or in parellel to that, try going through the introductory J labs. Labs are interactive, which walk you through examples of J, and allow you to experiment. Open the J menu item Studio>Labs and select "Language" from the dropdown. Go through the labs in that category. I strongly recommend you read up. Until you understand what's problematic with statements like "I don't want to define a verb" and questions like " Is there a way to make a program run without having to supply it with a value like that?" you'll never be able to write programs in J. -Dan ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
