Don, Murray and Bill, I'm a newbie too and I found the files lab 
helpful but incomplete. For instance it mentions 'm' as an option too, 
is there a list of these options somewhere?
(I didn't go back and check...so I could be wrong but I thought it was 
in files-lab - but I did certainly see it recently in the J help system)

Which brings up another point for newbie and newbie attraction to 
J...help is often there but finding it is tough, topics like file 
read/write are critical to a good impression of J system for general 
computing. The general approach of most J pro's seems to be read it in 
as fast as you can then use the power of J to manipulate it the way you 
want. Which is great once you know J well enough.
Having the skills to read and manipulate data into J from files of the 
OS is so fundamental I'd say its worth more than a lab or some 
references like in foreign - it needs good clear well explained 
examples that assume the user has the simplest J skills.

The skills to learn the hard way and that I found most useful were :-
1) fundamental reading of a file using names in strings (I literally 
had to find WHERE files are assumed to be on my system first, where's 
home, I ended up using absolute strings to ensure I found things..and 
this explanation needs to be explicit with paths even if it varies by 
OS, list 'em there's not that many!)
2) Use and need for boxing of names and values (both of file names and 
of data ) is something  you'll need right away and something that's not 
a level 0 skill in J (its not that hard of course but it is above +/ i. 
5 type level which I think of as level 0)
3) extraction of commas / quotes / LF /LFCR to start to remove the 
extraneous human readable crutch elements from data
4) making data into lists for J
       a) use of ". and ": (do and format)
       b) getting around the data being mixed types (integer, string, 
etc.)
       c) making data appear in the right form - what shape has it now, 
and how to change that shape (easily!) - that's a level 2 skill
5) same again for writing out files

I know these are all in the system for users to find (I found most of 
them the afternoon I attacked a ProjectEuler problem on names in a 
file) but frankly I'm still a novice and having a clear deeper intro 
(files in labs almost does it) would really have helped me.

As a newbie I found J alluring (in the extreme) but some hurdles can 
make that shine wear off fast, files is one, and there's sometimes an 
attitude of "well this is hard, so work on it a while" - which is ok if 
you have the time. The first time you thing J can be useful you want 
that faith returned not made hollow with this type of brush 
off...honestly I have tried to get work colleagues interested in J and 
they are put off with the learning curve (make that learning cliff) 
they see ahead. I have worked at this a while now and its just 
beginning to workout...I hope its worth it!

Now if I can just have my brain click over into J-thinking like it did 
once before into Smalltalk-thinking I'd be all set ! (Hey its coming I 
know it is LOL)
Phil








On Monday, May 27, 2013 11:37:51 Phil-AM, Don Guinn wrote:
> Look in the "Files" lab. Years ago I fought the same battle. At that time
> the comments were still in "files.ijs" and I stole them to create the
> "files" lab. This was all before the J WIKI existed, so I wrote the lab in
> a reference style. Now it would be better to move the reference material to
> WIKI and  keep just examples in the lab. One of these days.
>
>
> On Mon, May 27, 2013 at 8:47 AM, Murray Eisenberg 
> <mur...@math.umass.edu>wrote:
>
>>
>> On 26 May 2013 15:32:47 -0600, Don Guinn <dongu...@gmail.com> wrote:
>>
>> That does it; thanks!
>>
>> But how do you know about the optional 'b' argument of fread? I cannot
>> find documentation about fread at all -- either in J701 or J801 using
>> scriptdoc or in the help pages, included with J or on-line.
>>
>> Where did you find that documented?
>>
>> And if it's not in the documentation, is this something one is just
>> supposed to intuit, or know only if he's a member of some secret cult and
>> is told as part of initiation rites?
>>
>>> sortandprint=:4 : 0
>>>
>>> text=.'b' fread y
>>>
>>> text=./:~text
>>>
>>> text=.text,&.>LF
>>>
>>> (;text) fwrite x
>>>
>>> )
>>>
>>>
>>> The 'b' option means box each line.
>>>
>>>
>>> y is file to read,
>>>
>>> x is file to write sorted.
>>>
>>>
>>> If you are dealing with windows and need CRLF as a line separator,
>> replace
>>> the LF with <CRLF.
>>>
>>>
>>> On Sun, May 26, 2013 at 1:50 PM, Murray Eisenberg <mur...@math.umass.edu
>>> 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.
>>
>> ---
>> Murray Eisenberg                                    mur...@math.umass.edu
>> 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

--
Philip Hunt
Dum spiro spero.


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to