- For the K and BQN function that creates a one-element list containing its argument, see Pair.
Enlist (∊
) is a primitive function which returns a simple vector of all simple scalar values in a possibly nested array. Enlist differs from Ravel in that Enlist flattens over all layers of nesting, while Ravel flattens only the outermost layer. Enlist shares its glyph ∊
with the dyadic function Membership.
Support
APL2 IUP had ∊
mean Type[1] and Dyalog APL originally did too. However, by the time IBM released APL2, ∊
(which stood for e in prototypical element) was repurposed for Enlist (∊
being for e in enlist). Thus, Dyalog left the Type meaning in place only when migration level is 0, while setting it to 1 (the default) or higher follows IBM's replacement meaning.
Examples
Enlist is equivalent to a depth-first search collecting all simple scalars, where each layer (which in turn can be of any rank) is traversed in ravel order.
⎕←MAT←2 2⍴'MISS' 'IS' 'SIP' 'PI'
┌────┬──┐
│MISS│IS│
├────┼──┤
│SIP │PI│
└────┴──┘
∊MAT
MISSISSIPPI
⎕←M←1 (2 2⍴2 3 4 5) (6(7 8))
┌─┬───┬───────┐
│1│2 3│┌─┬───┐│
│ │4 5││6│7 8││
│ │ │└─┴───┘│
└─┴───┴───────┘
∊M
1 2 3 4 5 6 7 8
Enlist acts like Ravel for simple arrays. This includes simple scalars, where the result is a singleton vector.
⎕←mat←4 4⍴⍳16
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
(,mat)≡∊mat
1
∊3
3
3 ≡ ∊3 ⍝ Not the same
0
⍴∊3 ⍝ It's now a vector
1
External links
Lessons
Documentation
APL built-ins [edit]
|
Primitives (Timeline) |
Functions
|
Scalar
|
Monadic
|
Conjugate ∙ Negate ∙ Signum ∙ Reciprocal ∙ Magnitude ∙ Exponential ∙ Natural Logarithm ∙ Floor ∙ Ceiling ∙ Factorial ∙ Not ∙ Pi Times ∙ Roll ∙ Type ∙ Imaginary ∙ Square Root ∙ Round
|
Dyadic
|
Add ∙ Subtract ∙ Times ∙ Divide ∙ Residue ∙ Power ∙ Logarithm ∙ Minimum ∙ Maximum ∙ Binomial ∙ Comparison functions ∙ Boolean functions (And, Or, Nand, Nor) ∙ GCD ∙ LCM ∙ Circular ∙ Complex ∙ Root
|
Non-Scalar
|
Structural
|
Shape ∙ Reshape ∙ Tally ∙ Depth ∙ Ravel ∙ Enlist ∙ Table ∙ Catenate ∙ Reverse ∙ Rotate ∙ Transpose ∙ Raze ∙ Mix ∙ Split ∙ Enclose ∙ Nest ∙ Cut (K) ∙ Pair ∙ Link ∙ Partitioned Enclose ∙ Partition
|
Selection
|
First ∙ Pick ∙ Take ∙ Drop ∙ Unique ∙ Identity ∙ Stop ∙ Select ∙ Replicate ∙ Expand ∙ Set functions (Intersection ∙ Union ∙ Without) ∙ Bracket indexing ∙ Index ∙ Cartesian Product ∙ Sort
|
Selector
|
Index generator ∙ Grade ∙ Index Of ∙ Interval Index ∙ Indices ∙ Deal ∙ Prefix and suffix vectors
|
Computational
|
Match ∙ Not Match ∙ Membership ∙ Find ∙ Nub Sieve ∙ Encode ∙ Decode ∙ Matrix Inverse ∙ Matrix Divide ∙ Format ∙ Execute ∙ Materialise ∙ Range
|
Operators |
Monadic
|
Each ∙ Commute ∙ Constant ∙ Replicate ∙ Expand ∙ Reduce ∙ Windowed Reduce ∙ Scan ∙ Outer Product ∙ Key ∙ I-Beam ∙ Spawn ∙ Function axis ∙ Identity (Null, Ident)
|
Dyadic
|
Bind ∙ Compositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner Product ∙ Determinant ∙ Power ∙ At ∙ Under ∙ Rank ∙ Depth ∙ Variant ∙ Stencil ∙ Cut ∙ Direct definition (operator) ∙ Identity (Lev, Dex)
|
Quad names
|
Index origin ∙ Comparison tolerance ∙ Migration level ∙ Atomic vector
|