[Jprogramming] is there only one use for 4!:4 ?

Henry Rich henryhrich at gmail.com
Fri Aug 24 19:04:05 UTC 2018


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



More information about the Programming mailing list