Greg, when you define a variable with =. rather than =: it will be defined locally, as in only within the verb or script that you write it in. I believe that if you define a variable with =., say, at the top of an ijs, the variable will be defined for every verb and action within the script, but not in the ijx window; if the variable is defined with =. within a verb within an ijs, then the variable will only be recognized within the verb, and not within others defined in the same ijs. However, I am not aware of any way to "unset" variables (though there may be a valid way) other than by declaring them equal to i. 0 0 or ' ' or some other null phrase.
On Thu, Apr 4, 2013 at 10:29 PM, Greg Borota <[email protected]> wrote: > I think if you put this on top of your script file, it will always work > (before any other code might have a chance to load some other script). > scriptPath=.<_1{4!:3'' > > I am most probably even more of a beginner than you are so somebody with > more experience could validate if this is indeed reliable. > > Is there a way to unset variables once you no longer need them? Or a way to > define a local to script namespace? > Like you do in batch files: > SETLOCAL > do your work > ENDLOCAL > > > > > On Thu, Apr 4, 2013 at 9:05 PM, Greg Borota <[email protected]> wrote: > > > Looks like this one works too, inside the script: > > scriptPath=:>(4!:4<'NonExistent'){4!:3'' > > Now to go to the doc and understand how/why it works. > > > > > > On Thu, Apr 4, 2013 at 8:49 PM, Neill Robson <[email protected] > >wrote: > > > >> Tom, that's perfect! Actually, I think Devon mentioned the same or > similar > >> line of code, but it was your code that I realized I could use to my > >> advantage. Like I said, I was trying to find the file path to my ijs > file, > >> and your code found out the file path to where a particular object is > >> defined - Not necessarily the same intentions, but it gives the same > >> result. I just chose a verb from my ijs to use and it output the file > path > >> just like I needed; thank you so much for the help! > >> > >> > >> On Thu, Apr 4, 2013 at 8:58 PM, Linda Alvord <[email protected] > >> >wrote: > >> > >> > That's handy. > >> > > >> > Linda > >> > > >> > -----Original Message----- > >> > From: [email protected] > >> > [mailto:[email protected]] On Behalf Of Devon > >> > McCormick > >> > Sent: Thursday, April 04, 2013 5:55 PM > >> > To: J-programming forum > >> > Subject: Re: [Jprogramming] Obtaining the file path of an ijs file > >> > > >> > Perhaps not exactly what you're asking for as it's more granular than > >> the > >> > file level, but I've often found this verb useful (thanks, Dan!): > >> > > >> > whereDefined=: 3 : '(4!:4{.;:y) {:: (4!:3''''),<''Source of > >> definition > >> > not found for '',''.'',~y' > >> > > >> > It returns the path of the file in which a J object was defined. For > >> > example: > >> > > >> > whereDefined 'boxopen_z_' > >> > c:\Program Files (x86)\j64-701\system\main\stdlib.ijs > >> > > >> > With this caveat > >> > > >> > myfoo=: 'Defined only locally' > >> > whereDefined 'myfoo' > >> > Source of definition not found for myfoo. > >> > > >> > > >> > > >> > > >> > > >> > On Thu, Apr 4, 2013 at 5:41 PM, Greg Borota <[email protected]> wrote: > >> > > >> > > I am newbie too, but would BINPATH_Z_ work for you? > >> > > > >> > > > >> > > On Thu, Apr 4, 2013 at 4:35 PM, Neill Robson < > >> [email protected] > >> > > >wrote: > >> > > > >> > > > This may seem like a rather simple question compared to the others > >> > > > being brought up, however I cannot seem to be able to find a way > to > >> > > > call up an ijs file's "path" for use as a noun. I would like to > >> > > > somehow use it like one would use the "jpath" command when > accessing > >> > > > something within the J program files folder, so that one does not > >> > > > have to type out the > >> > > C:/Program > >> > > > Files path name every time. I'm probably missing something > obvious, > >> > > > but > >> > > I'm > >> > > > still very much a newbie at J programming. Thank you! > >> > > > > -------------------------------------------------------------------- > >> > > > -- For information about J forums see > >> > > > http://www.jsoftware.com/forums.htm > >> > > > > >> > > > ---------------------------------------------------------------------- > >> > > For information about J forums see > >> http://www.jsoftware.com/forums.htm > >> > > > >> > > >> > > >> > > >> > -- > >> > Devon McCormick, CFA > >> > ^me^ at acm. > >> > org is my > >> > preferred e-mail > >> > ---------------------------------------------------------------------- > >> > For information about J forums see > http://www.jsoftware.com/forums.htm > >> > > >> > ---------------------------------------------------------------------- > >> > For information about J forums see > http://www.jsoftware.com/forums.htm > >> > > >> > >> > >> > >> -- > >> -Neill > >> ---------------------------------------------------------------------- > >> For information about J forums see http://www.jsoftware.com/forums.htm > >> > > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- -Neill ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
