The J801 stdlib is not officially documented (we know it should be, and
we'll work on this when it is stable).

The best way to find out what it contains is to get the source from our
svn. It is not large, and does indeed have comments, e.g. see
http://jsoftware.com/websvn/wsvn/base8/trunk/main/main/files.ijs.

Incidentally, the file functions have changed little over the years. I
think the only two major recent changes are support for unicode file names,
and automatically doing jpath on the file argument.

BTW, J801 is still in beta, so discussions should be in the beta forum,
thanks.

Chris

On Mon, May 27, 2013 at 3:50 AM, Murray Eisenberg <[email protected]>wrote:

> I'm really out of practice with J, and the meager-to-nonexistent
> documentation is not helping me. I have a very simple task to perform. I
> have a text file infile.txt on my desktop and here's what I want to do:
>
>  (1) read the file as lines (so I don't get all the end-of-line symbols);
>  (2) sort the file's lines (alphabetically)
>  (3) write out the result as a new text file, say outfile.txt, also on my
> desktop.
>
> I can do this trivially in Mathematica:
>
>  t = Import["~/Desktop/infile.txt", "Lines"]
>  Export["~/Desktop/outfile.txt", Sort[t]]
>
> But how would I do this in J (which, for longer files, ought to be faster)
> and how would I discover how to do it? I prefer to use named library
> functions where applicable.
>
> I tried the following in J801, after looking into text.ijs from J602:
>
>   load 'files'
>   t=. fread '~/Desktop/infile.txt
>   load 'text'
>   cuttext t
> | value error: cuttext
>
> What happened there?
>
> [Hope this is not too basic for this forum (as compared with
> [email protected]).]
>
> ---
> Murray Eisenberg                                    [email protected]
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower            phone 413 549-1020 (H)
> University of Massachusetts                               413 545-2838 (W)
> 710 North Pleasant Street                         fax   413 545-1801
> Amherst, MA 01003-9305
>
>
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to