1/ 4!:7 returns the previous value of the script index.  Isn't that enough?

2/ I would have you use a modified script verb.  Or, make the case very strongly for why you need 4!:8.  Currently the script index is stored only in names, not in the script-name list.

Henry Rich

On 11/24/2019 2:57 PM, Kirk Iverson wrote:
1/ I'm trying to make use of these new script name foreigns and either I'm 
missing something or they are. My main problem is in the ability to pop the 
stack once the script which I have explicitly named has completed.

4!:6 seems to return the script index you've just named, and is a perfect 
argument to 4!:7. But once I'm done monkeying with things (eg with a 0!:100), 
how do I undo my recent 4!:7 -- I don't know what the previous script index was.

For my purpose I'd like something that undoes the most recent 4!:7, or returns 
the current script index.

Better still, I would like a dyadic form of 0!:k which accepts the script name 
in the left argument and sets it for the duration of its operation, so I don't 
have to worry about any of this stuff, eg:
    myscriptname 0!:100 myscriptcontents


2/ While on the topic of these 4!:y foreigns, I'd also like to see one which 
returns a list parallel to 4!:3, but whose items identify the script which was 
running when the corresponding element of 4!:3 was added, eg:

   4!:4 <'LF'    NB. index of script which defined <LF>
2
    >2{4!:3 ''    NB. script name
C:\Users\kbi\j901\system\main\stdlib.ijs
    2{4!:99 ''   NB. script index which loaded stdlib
1

(Obviously, 0{4!:99 ''  would have to be something like _1 to indicate we're at 
the root).

That way I can reconstruct the tree of scripts as they were loaded. I do something 
similar now with a hijacked <script> verb, but it doesn't catch everything.

/K

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to