From APL Wiki
Jump to navigation Jump to search

Conformability describes the conditions that must be satisfied by arguments to dyadic scalar functions. The arguments must match in shape, taking into account scalar extension and, when it is supported, singleton extension. The criteria which determine the result shape are often considered part of conformability as well. Some functionality, such as multiple assignment, might use modified conformability rules.

Two arguments are said to conform when either

  • They have identical shapes, or
  • One of them is extendible (it is a scalar, or, in languages with singleton extension, has exacly one element).

The result shape associated with such arguments can then be determined:

  • If the shapes matched, it is that shape
  • If exactly one argument was extended, it is the other argument's shape
  • Otherwise, it is the shape of the argument with the largest rank (this condition is only possible with 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