In Iverson notation, the prefix vector and suffix vector of weight and length are Boolean vectors that can be used with Compress to select a prefix or suffix of a vector, a task now performed with Take. Primitives ⍺
and ⍵
based on this notation were defined in IVSYS/7090 and APL\360, but removed from APL\360 before its public release in 1968.
The prefix vector is defined to be the length- vector where the first elements (or , if smaller) are 1 and the rest are 0. Likewise, the suffix vector has that many 1s at the end. In 1-indexed APL, N⍺J
was defined to be J≥⍳N
and N⍵J
to be (1+N-J)≤⍳N
. Because Iverson notation allows the length of a vector to be inferred from context, the first elements of vector can be taken with , and similarly and take the first columns or rows of a matrix. In APL, what is now J↑V
(for J≥0
and J≤N
) was written ((⍴V)⍺J)/V
, and (-J)↑V
was ((⍴V)⍵J)/V
(although most likely the shape ⍴V
would have been saved elsewhere in the program rather than being written out). An instance of Drop such as J↓V
was written (~(⍴V)⍺J)/V
.
The prefix and suffix vectors were considered two out of a class of "special vectors", with the others being the interval vector , now ⍳
, and the "full vector" of all 1s and "unit vector" , where the value at index is set to 1. However, was also used for Membership (the "characteristic vector"), which is closely related in that is (⍳N)∊J
; only this meaning was defined in APL. The glyphs ⍺
and ⍵
came to be used as argument names in direct definition and later dfns.
Very little has been rendered obsolete in the course of this. One thing that has been, and gave us some pain, (I don’t know if it gives you any pain) and that was the removal of the alpha and omega from the list of operators; but I don’t think the released systems had those, so you never missed them. We had them and it was a bit of a jar to lose them. But they are gone now.
—Adin Falkoff[1]
References
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
|