[Jprogramming] is there only one use for 4!:4 ?
Raul Miller
rauldmiller at gmail.com
Fri Aug 24 19:19:30 UTC 2018
Note that you can append a: (or whatever other boxed string) to the
value from 4!:3 before indexing with the result from 4!:4
Perhaps having the system do this would be a slight convenience?
Thanks,
--
Raul
On Fri, Aug 24, 2018 at 2:57 PM 'Pascal Jasmin' via Programming
<programming at jsoftware.com> 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
More information about the Programming
mailing list