Statement separator: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 11: Line 11:
When tracing errors within a line containing statement separators (<syntaxhighlight lang=apl inline>⋄</syntaxhighlight>), statements to the right of the caret have not yet been executed.  
When tracing errors within a line containing statement separators (<syntaxhighlight lang=apl inline>⋄</syntaxhighlight>), statements to the right of the caret have not yet been executed.  


Statement separators to the right of a [[comment]] are ignored.  
Statement separators to the right of a [[comment]] <syntaxhighlight lang=apl inline>⍝</syntaxhighlight> are ignored.  


== Examples ==
== Examples ==

Revision as of 23:11, 10 November 2022

Statement Separator () often called by the name of its glyph Diamond, allows you to place multiple statements on a single line. It works both inside a function and directly within the interpreter. Statement separators can be empty.

It is important to note that using a Statement Separator() forces the interpreter to read from left to right. Each separated statement will be read as if it is on it's own line.

In Iverson's Dictionary of APL [1] he states "expressions using the statement separator () can be mimicked by expressions using the verb left Identity. 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 tack ().

According to the Sharp APL Reference Manual[2] branching takes precedence over statement separators. ie "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"

When tracing errors within a line containing statement separators (), statements to the right of the caret have not yet been executed.

Statement separators to the right of a comment are ignored.

Examples

Statements are read from left to right:

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

External links

Documentation

References

APL built-ins [edit]
Primitives (Timeline) Functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare Root
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Non-Scalar
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentityStopSelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndexCartesian ProductSort
Selector Index generatorGradeIndex OfInterval IndexIndicesDealPrefix and suffix vectors
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-BeamSpawnFunction axis
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductDeterminantPowerAtUnderRankDepthVariantStencilCutDirect definition (operator)
Quad names Index originComparison toleranceMigration levelAtomic vector