12.07.2015 Views

Programmer's Guide & Language Reference - Dyalog Limited

Programmer's Guide & Language Reference - Dyalog Limited

Programmer's Guide & Language Reference - Dyalog Limited

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Namespace SyntaxChapter 1: Introduction 32Names within namespaces may be referenced explicitly or implicitly. An explicit referencerequires that you identify the object by its full or relative pathname using a'.' syntax; for example:X.NUMB ← 88sets the variable NUMB in namespace X to 88.88 UTIL.FOO 99calls dyadic function FOO in namespace UTIL with left and right arguments of 88and 99 respectively. The interpreter can distinguish between this use of '.' and itsuse as the inner product operator, because the leftmost name: UTIL is a (class 9)namespace, rather than a (class 3) function.The general namespace reference syntax is:SPACE . SPACE . (...) EXPRWhere SPACE is an expression which resolves to a namespace reference, and EXPR isany APL expression to be resolved in the resulting namespace.There are two special space names:# is the top level or 'Root' namespace.## is the parent or space containing the current namespace.⎕SE is a system namespace which is preserved across workspace load and clear.ExamplesWSDOC.PAGE.NO +← 1#.⎕NL 2⍝ Increment WSDOC page count⍝ Variables in root spaceUTIL.⎕FX 'Z←DUP A' 'Z←A A'⍝ Fix remote function##.⎕ED'FOO'⍝ Edit function in parent space⎕SE.RECORD ← PERS.RECORDUTIL.(⎕EX ⎕NL 2)⍝ Copy from PERS to ⎕SE⍝ Expunge variables in UTIL(⊃⎕SE #).(⍎⊃↓⎕NL 9).(⎕NL 2)⍝ Vars in first ⎕SE⍝ namespace.UTIL.⍎STRING⍝ Execute STRING in UTIL space

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!