Is this what you want?
> (4!:4 <'fread'){4!:3'' NB. find where fread is defined
C:\Users\Tom Arneson\j801a_win64\j64-801\system\main\stdlib.ijs
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Neill Robson
Sent: Thursday, April 04, 2013 17:40
To: [email protected]
Subject: Re: [Jprogramming] Obtaining the file path of an ijs file
BINPATH_Z is similar to what I want (it's closer, since it's a noun rather
than a verb), but it only shows the file path of the main J bin folder. I'm
looking for something similar to Greg's code, but rather than outputting
where an object in particular is defined, I would just like to know where
the current ijs file is located. For example, if an ijs is on a folder named
"examples" on my desktop (on Windows 7), than I want a verb in my ijs that
can output "C:\Users\Neill\Desktop\examples". However, I want the verb (or
noun like BINPATH, if there exists one) to be flexible, finding a different
file path if the ijs is moved elsewhere. Thank you for the quick responses!
On Thu, Apr 4, 2013 at 6:20 PM, Greg Borota <[email protected]> wrote:
> Say you want to execute stdlib.ijs per as Devon mentioned, this works
> too from what I can see:
> 0!:0 <BINPATH_Z_,'/../system/main/stdlib.ijs'
>
> (Here's my own J exercise for today)
>
>
> On Thu, Apr 4, 2013 at 4:54 PM, Devon McCormick <[email protected]>
> wrote:
>
> > 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