Let's say I have the following namespace in the APL file F.apln
:
:Namespace F
foo←{...}
:Endnamespace
I want to import this namespace in another namespace and use it. For example:
IMPORT F
:Namespace G
foo2←F.foo∘÷
:Endnamespace
How?
It depends on what exactly you're trying to do.
:Require file://F.apln :Namespace G foo2←##.F.foo∘÷ :Endnamespace
Note the ##.
which is necessary to reach out of G
as the two namespaces are siblings in the namespace hierarchy.
:Namespace G ⎕FIX'file://F.apln' foo2←F.foo∘÷ :Endnamespace
Amend the path to F.apln if the file isn't in the current directory.
:Namespace G ∇ foo2←foo2 foo2←##.F.foo∘÷ ∇ :Endnamespace
Here, we wrap foo2
in a tradfn so the evaluation of the ##.F
reference is deferred to run time.