Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!jvnc.net!darwin.sura.net!haven.umd.edu!socrates!socrates!rockwell
From: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Subject: Re: Mastering J; Workspace; Ambivalence
In-Reply-To: wchang@primate.cshl.org's message of Thu, 26 Mar 92 06:18:44 GMT
Message-ID: <ROCKWELL.92Mar26082817@socrates.umd.edu>
Sender: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Organization: Traveller
References: <1992Mar26.061844.27000@cshl.org>
Date: Thu, 26 Mar 1992 13:28:17 GMT
Lines: 50

Bill Chang:
   I am not yet convinced that J implements the "workspace" as does
   APL; 

J implements the following workspace routines:

 ws_class =: workspace_NameClass                        =: 2!:0
 ws_list  =: workspace_NameList                         =: 2!:1
 ws_save  =: workspace_Save                             =: 2!:2
 ws_psave =: workspace_ProtectedSave                    =: 2!:3
 ws_copy  =: workspace_Copy                             =: 2!:4
 ws_erase =: workspace_Erase                            =: 2!:55

In all cases, the right argument identifies the workspace(s).  It is
either a single boxed name, or a list of boxed names.

The save and copy verbs all take an optional left argument which is
the list of names you wish to save or copy.  The protected versions
will not overwrite existing names.

As a simple example, let's say I wanted to save the new definition of
'regcomp' into several different workspaces:
   (<'regcomp')  ws_save  'prod.jws';'backend.jws';'format.jws'

Or, let's say I wanted to retrieve several objects from some
repository:
   ('textrepl';'dispform';'ssndx';'ssdir')  ws_copy  <'miscfns.jws'

The erase and nameclass verbs also take a list of names as a left
argument, but in this case the argument is required.  Erase removes
names from a workspace.  NameClass returns a number indicating if the
name is undefined, a noun, verb, adverb, conjunction in that workspace
(or if it's ill formed, though this is not workspace dependent).

Note that for the dyadic cases of each of these verbs, the left and
right arguments must conform, in shape.  (Scalar extension holds,
obviously).  Also note that these routines only deal with the global
symbol table of a workspace.

NameList simply returns the list of names which are defined in that
workspace.  I'm not quite sure why this doesn't take a numeric
argument to specify which kind of names you're interested in.  [e.g. 3
for functions].  I seem to recall that earlier versions had this
feature, but I may be mistaken.

For more information, see the file 'xenos.doc' that comes with the
current j distribution.

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