Quote:
David Cabana writes:
>Is it possible to save J results in some form other than a workspace?
You can maintain your programs in regular textfiles and load them into
J via 0!:2 and 0!:3. And you can write output to textfiles.
For example to write a noun from J you could use the following verb :
Then ( x write <'b' ) writes x to filename b.
And FYR, here is the counterpart to read which reads a textfile into J:
So (z =. read 'textfile') makes z a character table in J (use ". to
turn it into numbers).
Most J programmers I know to don't use workspaces at all.
However, a fellow name Mr. Frey wrote an article in VECTOR
where he explains how workspaces can be used to provide
object-oriented capabilities.
If you have a lot of output and you want
to organize your it so that it can be found with a key
then you should check out MikePowell J programs for
doing this or my C translation of his programs.
Quote:
>Say some computations results in a large matrix and I want to export that
>matrix to Mathematica. How can I do it?
The first step is to get familiar with the basic structs Ma uses
to store its matrices.
Then you would want to write wrappers which convert Ma data
structure into J's A struct, for when you are calling J from Ma, and visa
versa, for when you are calling Ma from J. (Generally I would think it
would be much more helpful to call Ma from J than visa versa.) As far
as learning the J structs is concerned, j.h and jt.h are about all you
have to study. If you want the names of the C programs which implement
the primitive J verbs, then examine t.c.
As to how do you do it. I recommend looking at the J-lapack interface
at watserv1.waterloo.edu in languages/apl/j/workspaces (and there
is an interface to vfftpack in the 1993.q2 archive).
Quote:
> If I could write the matrix as to a text file, great.
I just gave you that, but any respectable interface will have
to have the interface in C. This way there is no duplication
of memory allocation and no reading&writting textfiles which
will make your applications with large n crawl.
Quote:
> But what can I do with a workspace to make it accessible to anything but J?
I think you've got that.
I recommend that you ftp to ftp.cs.ualberta.ca and get
pub/smillie/intj.ps and intj.doc. This is paper provides a well
written introduction to J for beginners.
If you will be hacking the J source I suggest purchasing
An Implementation of J.
-emmett