0

I want to be able to use the same config file across all of my machines, and my username is unfortunately different at work, so absolute paths are difficult for me to use.

Is there a common way to specify non-absolute directories for LIBREF-* variables in the GNU APL preferences file? It seems like tilde expansion and environment variables are not interpreted. But I can't find any info on this through Google.

Thank You for Your time.

EDIT 1:

To be clear, I have tried the following:

LIBREF-0 = $HOME/Documents/apl-libs/lib0

But it seems to show up inside of )LIBS with $HOME intact.

2 Answers2

1

You can specify the mapping between library reference numbers (i.e. 0 to 9) to directories in one of the GNU APL preference files, or at runtime with the )LIBS command. See https://www.gnu.org/software/apl/apl-intro.html#CH_4.3.4.

Jürgen
  • 31
  • 2
  • Just to mention it: you can specify multiple mappings from library reference numbers to paths and select the desired one with the -p (profile) command line option of the interpreter. – Jürgen Sep 06 '22 at 09:37
  • Hi @Jürgen, thank You for taking the time to respond! I came across the information You presented in the info file, but I can't seem to get it to accept anything other than an /absolute/ path-name. Say the user stores their personal library in `/home/user/workspaces`. In order to reference that, I seem to be forced to use `/home/user/workspaces` in the `~/.config/gnu-apl/preferences` file—that is, I cannot use `$HOME/workspaces` nor `~/workspaces` to refer to the directory, as I would in bash. Is this correct? And if so, is this the intended behavior? – Christopher Rodriguez Sep 06 '22 at 20:42
  • I've accepted my workaround as the solution for now, but if there is a more straightforward way to do so I'm happy to switch the accepted answer upon learning it. – Christopher Rodriguez Sep 08 '22 at 18:52
0

In my search through the documentation, I came across a reference to the $APL_LIB_ROOT environment variable.

If this is set and there are no other definitions for library directories in both the system and user preferences files, then GNU APL will use the following directory structure to populate these values:

LIBREF-0 = $APL_LIB_ROOT/workspaces
LIBREF-1 = $APL_LIB_ROOT/wslib1
LIBREF-2 = $APL_LIB_ROOT/wslib2
LIBREF-3 = $APL_LIB_ROOT/wslib3
LIBREF-4 = $APL_LIB_ROOT/wslib4
LIBREF-5 = $APL_LIB_ROOT/wslib5
LIBREF-6 = $APL_LIB_ROOT/wslib6
LIBREF-7 = $APL_LIB_ROOT/wslib7
LIBREF-8 = $APL_LIB_ROOT/wslib8
LIBREF-9 = $APL_LIB_ROOT/wslib9

However, at least on the system I am using (GNU Guix), there are entries in the system-wide configuration file for the included libraries for 3, 4, and 5 (which is what is intended by upstream).

This works around my problem, but was not clearly documented anywhere I could find, so I figured it would do well to be an answer. Below are some links I found helpful while discovering this.