> ---Kip Murray wrote: > > Where does a beginner learn good J work habits?
As Andrew has suggested, "good J work habits" probably depend to a large extent on the user & what they use J for. It is interesting to hear how others use J, and there have been some good tips so far. I imagine which tips different people find to be "good" will come down to personal preference to some extent. For example: I largely agree with Devon's tip for commenting conventions but would recommend a slightly different version that is supported by the utilities in the standard library for summarising and documenting scripts (scriptdoc & export). It is described on this page: <http://www.jsoftware.com/help/user/scriptdoc.htm> (The export script is described here <http://www.jsoftware.com/help/user/exportscript.htm> ). I would also use a slightly more descriptive name for the verb. Devon's verb would look like this: NB.*createTmpFile v Create new, randomly named file in temp dir NB. eg: batfl=. createTmpFile 'bat' NB. y is: optional file extension. Defaults to 'tmp' createTmpFile=: 3 : 0 suff=. ,>(0=#y){y;'tmp' td=. getTempDir '' while. fexist flnm=. td,suff,~'.',~ALPHA{~?8$#ALPHA do. end. flnm ) Also Alex suggested the use of locales to separate different types of code. This helps organize your code and avoid name clashes. However rather than define the application specific code in 'base' I'd suggest leaving that clear for the user/session and using an application specific locale (e.g. 'pmyappname') for your application code. You can define "pointer" verbs in the 'z' locale to the verbs that the user needs to interact with directly. So if createTmpFile and getTempDir were part of my application, I might define them in a locale called 'pmyutils'. If getTempDir was only a utility verb used by other verbs within my application and not intended for "external consumption", then I would only need to make createTmpFile generally available by defining it in the 'z' locale like this: createTmpFile_z_=: createTmpFile_pmyutils_
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
