I often use .ijs scripts for exploration and in early stages of development.
In the first line I always include enough to identify my intent when I
start.
I have a two functions in my profile which help cleaning up, renaming and
saving as and where they are best saved.
firstline takes any directory and gives the first line of the script. The
default is the temp directory.
fndef returns the script in which any function in the current locale or on
the path was defined.
The functions have only been used on Windows -others may need to modify
them.
Fraser
--------------------------------------------------
NB. read firstline of all scripts in directory
NB. default is 'temp\*.ijs'
firstline =: 3 : 0
load 'dir files'
if. 0=#y
do. y=. jpath,'~user\temp\*.ijs'
end.
dir1 =. dir y
fblank =. {. I. (+/ dir1=' ')= # dir1
fnames =. fblank {."1 dir1
fpath =. (>: y i: '\'){. y
fr1 =. {. @ ('m' fread ]) "1
fnames,.' ',.flines =. fr1 fpath,"_ 1 fnames
)
fndef =: 3 : '(4!:4{.;:y) {:: 4!:3'''''
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm