> But when I'm in the base locale, J will not recognize these 
> functions unlesss I use the form "function_locale_".
> How can I put my locale in some sort of search path, so that 
> J will use it without the suffix?

Use:

           coinsert_base_ 'locale'

> Also, I've discovered many J numbered locales. 

These have nothing to do with abnormal termination.  Numbered locales are 
instances of classes.  They're objects.  And they're not
automatically destroyed.  If you create an object,  and you want it destroyed, 
you must do so explicitly.  

Numbered locales are not reused, so every object you create gets a new, unique, 
numbered locale.  

In your case, I'm betting the objects in question are J session manager 
windows.  I say this because you said you typed:

           function_locale_ ''

instead of:

           L =: conew 'locale' 
           function__L ''

The former calls the function directly in the class; the latter creates an 
object (a numbered locale) and calls the function
within that instance.

A J session manager window is also an object.  So, a numbered locale is created 
for every session manager window.  In particular,
every script window you open gets its own numbered locale.  When you close the 
window, the session manager destroys the locale
(explicitly). 

Start a fresh J session, and try this:

           conl 1
        +-+
        |0|
        +-+
           
The zeroth locale is the IJX window.  Now press CTRL+N a bunch of times:

           conl 1
        +-+-+-+-+-+
        |0|1|2|3|4|
        +-+-+-+-+-+

Each of those locales corresponds to one of the windows you just created.  
Close a window, and its locale is erased; open another,
and a new one is created.  Try it:  you'll find  conl 1  will accrue "gaps".

But to answer your question, the following will find the highest numbered 
locale (which isn't neccesarily the last one created;
it's the last one created still extant):

           ({~ [: (i. >./) 0 ". ;:^:_1) conl 1
        +-+
        |4|
        +-+

And this will list all the variables (which I take to mean nouns) in that 
locale:

           highest =: ({~ ([: (i. >./) 0 ". ;:^:_1)) conl 1

           nl__highest 0 NB.  Nouns ("variables") only.
        +---------+-----+-------+-------+------+------+
        |COCREATOR|IFIJX|IFSAVED|SMHWNDP|SMNAME|SMTEXT|
        +---------+-----+-------+-------+------+------+

The RHA to  nl  is (a list of) the class of the names you want returned.  You 
can also use  ''  to indicate "any class/all names".

-Dan

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

Reply via email to