Aha, 4!:3 and 4!:4 seem to be what I was missing. That's a nice trick.
Thanks, Raul!

But still, it would be nicer if J supports something like this out of the
box :)

Jinwoo


On Mon, May 30, 2022 at 9:38 AM Raul Miller <[email protected]> wrote:

> Well... you could use the approach used here (lines 11 through 17):
>
> https://github.com/zerowords/tgsjo/blob/master/tgsjo.ijs#L11
>
> I hope this helps,
>
> --
> Raul
>
>
> On Mon, May 30, 2022 at 11:58 AM Jinwoo Lee <[email protected]> wrote:
> >
> > When my script file loads other files that I write, it would be very
> > convenient if we had a special jpath syntax for the folder that contains
> > the current file. For example, let's say my script is at
> /my/path/foo.ijs,
> > and it loads bar.ijs from the same folder.
> >
> > load 'bar.ijs'
> > ...
> >
> > Or it loads baz.ijs from a subfolder.
> >
> > load 'libs/baz.ijs'
> > ...
> >
> > But this works only when I run the script from the /my/path folder. If I
> > run it from, say, my home directory, load would fail to locate bar.ijs.
> >
> > If J provides a special path syntax, say, '~filefolder', I'll be able to
> do
> >
> > load '~filefolder/bar.ijs'
> > ...
> >
> > or
> >
> > load '~filefolder/libs/baz.ijs'
> > ...
> >
> > I'll be able to use ARGV_z_ to extract it but that would work only for
> the
> > main script file.
> >
> > Does this make sense? Or am I missing something obvious?
> >
> > Cheers,
> > Jinwoo
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> 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