I never use 4!:4 it to find a directory. I usually use it to find a file so I can inspect the definition, its surrounding comments or other contextual information.
Thanks, -- Raul On Fri, Aug 24, 2018 at 3:29 PM 'Pascal Jasmin' via Programming <[email protected]> wrote: > > > added to System/Interpreter/Requests - J Wiki > > > https://code.jsoftware.com/wiki/System/Interpreter/Requests > > > > > Is this something you see as important to do soon, or should I use my > workaround. > > Am I right in seeing 4!:4 as not used other than finding one's own script > directory? > > > > > On Friday, August 24, 2018, 3:04:10 p.m. EDT, Henry Rich > <[email protected]> wrote: > > > > > > Left arg to 0!:n is a good idea. I think we should have better support > for preprocessing scripts. Put it on the wishlist. > > > Henry Rich > > On 8/24/2018 2:57 PM, 'Pascal Jasmin' via Programming wrote: > > Rewriting scripts and then invoking them with 0!:0 noun (instead of file) > > has the disadvantage of "breaking" 4!:4. If 4!:4 is ever used on a > > definition from the file, it will report _1 (definition not from a script). > > This applies to definitions inside the original file, often used to find > > the directory of the program, and used to load related files and data. > > The perfect solution is to add an optional left argument to 0!:n noun which > > would be the filename returned by 4!;4 for definitions inside that noun. > > A solution I can do myself, applies if the only real use for 4!:4 is in > > fact to find "MYFILE" in a script. > > The solution is to replace in the file all top level instances of lines > > starting with (space intollerant) > > MYDIR =:MYFILE =: (NB. not sure if this is needed, as the file is usually > > obtained just to get MYDIR) > > with a hardcoded string derived from what the x argument (MYFILE) to 0!:n > > should be. > > If this function over-rode the load command, then 4!;4 would return empty > > for most definitions, which is only a problem if 4!:4 is ever used for > > anything other than on a variable within its own script . > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > --- > This email has been checked for viruses by AVG. > https://www.avg.com > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
