Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!qt.cs.utexas.edu!cs.utexas.edu!uunet!haven.umd.edu!socrates.umd.edu!socrates!rockwell
From: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Subject: Re: Programming in J
In-Reply-To: tom_affinito@next.com's message of 14 Nov 91 19: 09:26 GMT
Message-ID: <ROCKWELL.91Nov16011659@socrates.umd.edu>
Sender: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Organization: Traveller
References: <1991Nov10.190838.14635@ctr.columbia.edu> <2271@rosie.NeXT.COM>
Date: Sat, 16 Nov 1991 06:16:59 GMT

Tom Affinito:
   3) What I would like to see are small (15 to 20 line) problems
   being solved...problems that indicate styles for verb writing,
   splitting logic between noun state and verb logic, uses of tacit
   defs and gerunds, etc. People have posted large examples in the
   past...this is great, but I think that a great aid to help explain
   the "hidden logic" of a language is by working through several
   "reasonable" examples. The J docs by and large only provide
   one-liners....I think that the J-literates and J-wannabe's on the
   net can provide a great service through generating and debugging
   such problems.

Well, as a poster of such examples, I can say that it's rather
difficult to verbalize all of the thoughts that go into writing a
program.  Furthermore, much of the thinking is simply a re-statement
of what each primitive does, or a set of "proto-typical" examples...

Actually, from my point of view, the thing that seems to generate the
most interest is a set of obvious (and perhaps not so obvious)
blemishes.  Then, clever people can say "Aha!  I can see how to do
that better."  And maybe in the process they learn something.

Fortunately, I'm quite adept at putting such blemishes into my posts.
:-)

   Possible small problems...simple file parser that reverses the
   letter order of each line,

You mean like
   read=.   1!:1
   append=. [ 1!:3 <
   nl=. 10{a.
   (=&nl  append&'outfile'@ (,&nl)@ |. ;._2 [) read <'infile'
???

There isn't much to this:  read the file, cut it up on line
boundaries, reverse each line, add a trailing newline to each line,
and stick it back out on file.  You could get rid of the (,&nl)@  if
you changed the ;._2 to a :.2, and didn't mind that your newlines had
moved from the end of each line to the beginning of each line...

   small biorhythm program illustrating interactive terminal operators
   (maybe with terminal graphics...ok, this is not a small program,
   but it could be patched together from perhaps three small
   programs), a small graphic library illustrating workspace name
   choices and given names, etc (all these just off the top of my
   head)...

Um... aren't graphics rather machine specific?  Also, aren't
biorhythms rather non-interactive?  [they just sit there.]

As for the workspace name stuff, this works rather well:

   lws=. list_workspaces=. 0!:0@('ls '&,@ (,&'/*.jws'))
   lwnms=. list_workspace_names=. 2!:1 @ <

Ok, so it's not very flashy.  However, the first will work on any unix
machine, while the second will work on anything [that supports J, that
is].

Point taken, though.  Maybe I'll try and post some interface code.
[However, there's nothing magic about me -- you can post too, you
know.] 

-- 
Raul Deluth Miller-Rockwell
<rockwell@socrates.umd.edu>
