Skip to content

Primitive Functions (by Category)

The primitive functions can be grouped together into categories that exhibit common behaviours or goals. Functions can be in multiple categories.

Scalar Functions

Scalar functions apply to simple scalars and are pervasive.

Monadic Scalar Functions

Monadic scalar functions apply independently to each simple scalar in their argument.

The result has the same structure as the argument, and is numeric (exception: +Y preserves the types of the argument).

Syntax Meaning
+Y Conjugate
-Y Negate
×Y Direction
÷Y Reciprocal
|Y Magnitude
*Y Exponential
⍟Y Natural Logarithm
○Y Pi Times
⌈Y Ceiling
⌊Y Floor
!Y Factorial
?Y Roll
~Y NOT

Dyadic Scalar Functions

Dyadic scalar functions apply independently to corresponding pairs of simple scalars in their arguments. The result has the same structure as the arguments, subject to scalar extensions, and is always numeric.

If a simple scalar corresponds to a non-scalar, the simple scalar is replicated to the shape of the non-scalar.

A singleton (single-element array) is treated as a scalar for scalar extension purposes; if both arguments are singletons, then the lower-rank argument is extended to the rank of the higher-rank argument.

Syntax Meaning
X+Y Plus
X-Y Minus
X×Y Times
X÷Y Divide
X|Y Residue
X*Y Power
X⍟Y Logarithm
X○Y Circular Functions
X⌈Y Maximum
X⌊Y Minimum
X!Y Binomial
X∧Y Lowest Common Multiple
X∨Y Greatest Common Divisor
X~Y Without
X∧Y AND
X∨Y OR
X⍲Y NAND
X⍱Y NOR
X<Y Less Than
X≤Y Less Than Or Equal To
X=Y Equal To
X≥Y Greater Than Or Equal To
X>Y Greater Than
X≠Y Not Equal To

Mathematical Functions

Mathematical functions perform computations on numeric arguments; all except +Y, ⍋Y, and ⍒Y will reject non-numeric arguments.

Several of the monadic forms are equivalent to the dyadic forms with a default left argument.

Syntax Meaning
+Y Conjugate
X+Y Plus
-Y Negate
X-Y Minus
×Y Direction
X×Y Times
÷Y Reciprocal
X÷Y Divide
|Y Magnitude
X|Y Residue
*Y Exponential
X*Y Power
⍟Y Natural Logarithm
X⍟Y Logarithm
○Y Pi Times
X○Y Circular Functions
⌈Y Ceiling
X⌈Y Maximum
⌊Y Floor
X⌊Y Minimum
!Y Factorial
X!Y Binomial
?Y Roll
X?Y Deal
X⊤Y Encode
X⊥Y Decode
⌹Y Matrix Inverse
X⌹Y Matrix Divide
X∧Y Lowest Common Multiple
X∨Y Greatest Common Divisor
⍋Y Grade Up
⍒Y Grade Down
X⍕Y Format by Specification

Logic Functions

Logic functions represent logic gates. Their arguments and results are Boolean (comprising only 1s and 0s).

Syntax Meaning Logic Gate
~Y NOT NOT
X∧Y AND AND
X∨Y OR OR
X⍲Y NAND NAND
X⍱Y NOR NOR
X<Y Less Than CNIMPLY
X≤Y Less Than Or Equal To IMPLY
X=Y Equal To XNOR
X≥Y Greater Than Or Equal To CIMPLY
X>Y Greater Than NIMPLY
X≠Y Not Equal To XOR

Comparison Functions

Comparison functions perform comparisons. They return Boolean results indicating whether the comparisons are true (1) or false (0).

Syntax Meaning
X<Y Less Than
X≤Y Less Than Or Equal To
X=Y Equal To
X≥Y Greater Than Or Equal To
X>Y Greater Than
X≠Y Not Equal To
X≡Y Match
X≢Y Not Match
X∊Y Membership

Selection Functions

Selection functions restrict the parts of their arguments that are propagated into their result (exception: X⊢Y and X⊣Y return one of their arguments).

Syntax Meaning
X⌷Y Index
⊃Y First
X⊃Y Pick
X/Y Replicate
X⌿Y Replicate First
X\Y Expand
X⍀Y Expand First
X⍉Y Dyadic Transpose
X↑Y Take
X↓Y Drop
X∩Y Intersection
∪Y Unique
X∪Y Union
X⊢Y Right
X⊣Y Left

Set Functions

Set functions operate on arrays representing collections. Within the set functions:

  • X∩Y, X∪Y, and X~Y are restricted to vectors.
  • X~Y, X∩Y, ∪Y, and X∪Y return new collections.
  • ≠Y, X≡Y, X≢Y, and X∊Y return Boolean results (comprising only 1s and 0s).
Syntax Meaning
X~Y Without
X∩Y Intersection
∪Y Unique
X∪Y Union
≠Y Unique Mask
X≡Y Match
X≢Y Not Match
X∊Y Membership

Search Functions

Search functions determine whether/where values are located.

Syntax Meaning
X⍳Y Index Of
⍸Y Where
X⍸Y Interval Index
X∊Y Membership
X⍷Y Find

Ordering Functions

Ordering functions return indices that can subsequently be used to select from within the original array.

Syntax Meaning
⍳Y Index Generator
X⍳Y Index Of
X⍸Y Interval Index
⍋Y Grade Up
X⍋Y Dyadic Grade Up
⍒Y Grade Down
X⍒Y Dyadic Grade Down

Index Generator Functions

Index generator functions return indices that can then be used directly or to select from within the original array.

Syntax Meaning
?Y Roll
X?Y Deal
⍳Y Index Generator
X⍳Y Index Of
⍸Y Where
X⍸Y Interval Index
⍋Y Grade Up
X⍋Y Dyadic Grade Up
⍒Y Grade Down
X⍒Y Dyadic Grade Down

Structural Functions

Structural functions modify the structure or shape of their right argument (including omitting values) but they do not otherwise change any scalar values.

Syntax Meaning
X⍴Y Reshape
,Y Ravel
X,Y Catenate/Laminate
⍪Y Table
X⍪Y Catenate First/Laminate
⌽Y Reverse
X⌽Y Rotate
⍉Y Transpose
X⍉Y Dyadic Transpose
⊖Y Reverse First
X⊖Y Rotate First
↑Y Mix
X↑Y Take
↓Y Split
X↓Y Drop
⊂Y Enclose
X⊂Y Partitioned Enclose
⊆Y Nest
X⊆Y Partition
⊃Y First
X⊃Y Pick
∊Y Enlist

Data Conversion Functions

Data conversion functions change between different representations of the same data.

Syntax Meaning
⌷Y Materialise
⍎Y Execute
X⍎Y Dyadic Execute
⍕Y Format
X⍕Y Format by Specification

Identity Functions

Identity functions make it easy to write ambivalent dfns and are useful in tacit programming, as generic operands, and to break up stranding. They do not modify structure, shape, or values (exception: ⌷Y, when applied to an object, extracts its default value).

Syntax Meaning
⌷Y Materialise
⊢Y Same
X⊢Y Right
⊣Y Same
X⊣Y Left

Array Property Functions

Array property functions provide information about a given array.

Syntax Meaning
⌷Y Materialise
⍴Y Shape
≡Y Depth
≢Y Tally