Statement separator

From APL Wiki
Revision as of 05:09, 11 November 2022 by Adám Brudzewsky (talk | contribs)
Jump to navigation Jump to search

Statement Separator () often called by the name of its glyph, Diamond, allows placing multiple statements on a single line. It works both inside a function and directly within the interpreter. Empty statements are generally ignored.

Description

The Statement Separator forces the interpreter to read from left to right. Each separate statement will be read as if on its own line.

A Dictionary of APL[1] states that "expressions using the statement separator () can be mimicked by expressions using the verb left. The primary difference is that the separation imposed by follows the normal rules for order of execution."

APL/700 uses a semicolon to achieve the same effect as the left Identity function .

Branch () takes precedence over statement separators. "If the expression to the right of the branch is not empty, the system goes immediately to the line whose number is the first element in that expression."[2]

When displaying an errors message, where the error happened on a line containing statement separators, statements to the right of the position indicated by the error caret have not yet been executed:

DOMAIN ERROR: Divide by zero
      2÷0 ⋄ 1+3
       ∧

Statement separators to the right of a comment are part of the command are therefore ignored.

Examples

Statements are read from left to right:

A←10 ⋄ A←A×3 ⋄ A÷2 
15

External links

Documentation

References

APL syntax [edit]
General Comparison with traditional mathematicsPrecedenceTacit programming (Train, Hook, Split composition)
Array Numeric literalStringStrand notationObject literalArray notation (design considerations)
Function ArgumentFunction valenceDerived functionDerived operatorNiladic functionMonadic functionDyadic functionAmbivalent functionDefined function (traditional)DfnFunction train
Operator OperandOperator valenceTradopDopDerived operator
Assignment MultipleIndexedSelectiveModified
Other Function axisBracket indexingBranchStatement separatorQuad nameSystem commandUser commandKeywordDot notationFunction-operator overloadingControl structureComment