Singleton

From APL Wiki
Jump to navigation Jump to search

A singleton is an array with bound 1. Equivalently, its shape consists entirely of 1s. It may have any rank. For example, all the following are singletons:

Whether an array X is a singleton can be determined with 1/X or, less efficiently, with 1=≢,X.

Every scalar X is a singleton, because 1/X, or alternatively 1=≢,X.

Singletons may be subject to singleton extension.

APL features [edit]
Built-ins Primitive functionPrimitive operatorQuad name
Array model ShapeRankDepthBoundIndexAxisRavelRavel orderElementScalarVectorMatrixSimple scalarSimple arrayNested arrayBoxCellMajor cellSubarrayEmpty arrayPrototype
Concepts and paradigms Leading axis theoryScalar extensionConformabilityScalar functionGlyphIdentity element
Errors LIMIT ERRORRANK ERROR