Promote
Promote is a monadic function that adds a length-1 axis to its argument before the other axes, resulting in an array with rank one higher. It appears as a primitive in Kap (<
, "increase rank") and Dyalog APL Vision (∧
), as well as J (,:
, "Itemize"), BQN (≍
, "Solo"), and Uiua (¤
, "Fix"). In J and BQN it's paired with the related dyadic primitive Laminate. The K primitive Enlist (,
), which creates a length-1 list containing its argument, can also be interpreted as Promote because depth and rank are equivalent in the list model of arrays.
For an argument A
, promote can be implemented as (1,⍴A) ⍴ A
or (⍳1) ∘.⊢ A
. The choice to add an axis at the beginning is based on leading axis theory, as this allows the axis to be placed in any other position using the Rank operator.
Documentation
- Kap
- J NuVoc, Dictionary
- BQN
- Uiua