# Singleton

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:

- The scalar
`42`

- The vector
`,42`

- The matrix
`⍪42`

- The three-dimensional array
`1 1 1⍴42`

- The nested scalar
`⊂4 2`

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 function ∙ Primitive operator ∙ Quad name |

Array model | Shape ∙ Rank ∙ Depth ∙ Bound ∙ Index ∙ Axis ∙ Ravel ∙ Ravel order ∙ Element ∙ Scalar ∙ Vector ∙ Matrix ∙ Simple scalar ∙ Simple array ∙ Nested array ∙ Box ∙ Cell ∙ Major cell ∙ Subarray ∙ Empty array ∙ Prototype |

Concepts and paradigms | Leading axis theory ∙ Scalar extension ∙ Conformability ∙ Scalar function ∙ Pervasion ∙ Glyph ∙ Identity element ∙ Total array ordering |

Errors | LIMIT ERROR ∙ RANK ERROR ∙ SYNTAX ERROR |