conew! Not sure why I did that...! I just meant to create a namespace. coclass.
2009/6/16 Matthew Brand <[email protected]>: > Here is one way to put some documentation in-line and make it easier > to get using J. The tabs do not line up when pasting into gmail but in > the J session they do. > > Anyhow: > > I have made a file ~system/main/easyJ.ijs defined as follows: > > <BEGIN1> > conew 'utils' > QUIET_utils_ =: 0 > message_utils_ =: 3 : 0 > if. -. QUIET do. > y (1!:2) 2 > end. > ) > > help_z_ =: 0 : 0 > For help, type "help". > For help on a topic type help_<topic>_. > I.e. help followed by the topic enclosed in underscores. > Available topics: > files > ) > > load jpath,'~system/main/files_mod_.ijs' > message_utils_ help_z_ > > cocurrent 'base' > <END1> > > > Then I copied ~system/main/files.ijs to files_mod_.ijs and modified > the start to: > > <BEGIN2> > conew 'files' > cocurrent 'files' > > help =: 0 : 0 > File Access Utilities > > read verbs take a right argument of a filename, optionally > linked with one or two numbers (as for 1!:11): > 0 = start of read (may be negative) > 1 = length of read (default rest of file) > > write verbs return number of characters written. > > filenames may be open or boxed character or unicode strings > > string verbs write out text delimited with the host OS delimiter, > and read in text delimited by LF. > > on error, the result is _1, > e.g. for file not found/file read error/file write error > > dat fappend_files_ fl -append > dat fappends_files_ fl -append string > verb fapplylines_files_ fl -apply verb to lines of file > to fcopynew_files_ fls -copy files (if changed) > to fcopynews_files_ fls -copy files as strings (if changed) > fdir_files_ file -directory > ferase_files_ fl -erase file > fexist_files_ fl -return 1 if file exists > opt fread_files_ fl -read file > opt freadblock_files_ fl -read lines of file in blocks > freadr_files_ fl -read records (flat file) > freads_files_ fl -read string > dat freplace_files_ fl -replace in file > opt fselect_files_ txt -select file > fsize_files_ fl -size of file > str fss_files_ fl -string search file > oldnew fssrplc_files_ fl -search and replace in file > fstamp_files_ fl -file timestamp > dat fwrite_files_ fl -write file > dat fwrites_files_ fl -write string > ) > NB. cocurrent 'z' > <END2> > > And put: > cocurrent 'base' > at the end of the file. > > > > > > > Then a J-session can be: > > <BEGIN3> > load jpath,'~system/main/easyJ.ijs' > For help, type "help". > For help on a topic type help_<topic>_. > I.e. help followed by the topic enclosed in underscores. > Availible topics: > files > > help_files_ > File Access Utilities > > read verbs take a right argument of a filename, optionally > linked with one or two numbers (as for 1!:11): > 0 = start of read (may be negative) > 1 = length of read (default rest of file) > > write verbs return number of characters written. > > filenames may be open or boxed character or unicode strings > > string verbs write out text delimited with the host OS delimiter, > and read in text delimited by LF. > > on error, the result is _1, > e.g. for file not found/file read error/file write error > > dat fappend_files_ fl -append > dat fappends_files_ fl -append string > verb fapplylines_files_ fl -apply verb to lines of file > to fcopynew_files_ fls -copy files (if changed) > to fcopynews_files_ fls -copy files as strings (if changed) > fdir_files_ file -directory > ferase_files_ fl -erase file > fexist_files_ fl -return 1 if file exists > opt fread_files_ fl -read file > opt freadblock_files_ fl -read lines of file in blocks > freadr_files_ fl -read records (flat file) > freads_files_ fl -read string > dat freplace_files_ fl -replace in file > opt fselect_files_ txt -select file > fsize_files_ fl -size of file > str fss_files_ fl -string search file > oldnew fssrplc_files_ fl -search and replace in file > fstamp_files_ fl -file timestamp > dat fwrite_files_ fl -write file > dat fwrites_files_ fl -write string > > help > For help, type "help". > For help on a topic type help_<topic>_. > I.e. help followed by the topic enclosed in underscores. > Available topics: > files > <END3> > > If something like this was accessible in the J session window (but > with many more topics) then I think J would be much easier to use > without such a high learning curve. > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
