Those who learned another APL, such as APL+Win, APL2, APLX and GnuAPL, should note that Dyalog has significant differences in the language and system.
Tools and Resources
- The APLX migration tools repository contains utilities and useful information for the migration of code from APLX to Dyalog.
- The
]TRANSFER.In
user command imports files in APL Transfer Format (.ATF) created by other APL systems. See]In -?
for more information. - The video Dyalog APL for other APL users by APLTrainer showcases various features of Dyalog APL and the Dyalog interpreter.
General Language Features
The tutorial and documentation pages linked below describe the behaviour of various language constructs in Dyalog.
- Assignment syntax has several extended features
- Control structures are a structured programming alternative to branching
- Migration level (⎕ML, also known as Evolution Level or Compatibility Setting in other APLs) selects compatibility with APL2/APL+Win/APLX/Gnu APL
- User-defined operators
- Error trapping with control structures can be more ergonomic than (the also supported) ⎕TRAP
- Shyness suppresses printed output of some functions in the session
- Nested arguments and results in tradfn headers
- Total array ordering (grading and sorting arbitrary arrays)
- Complex numbers
Object-oriented features
The two guides Object Oriented Programming for APL Programmers and Object Oriented Programming for (impatient) APL Programmers give an overview of object-oriented language constructs in Dyalog. Documentation and tutorials for key aspects are linked below.
New primitive functions
- GCD (
∨
) and LCM (∧
) extend logical OR and AND to useful number theoretic functions - Right tack (
⊢
) and Left tack (⊣
) are simple but versatile identity functions - Materialise (
⌷
) gets the default property of a class instance, and decomposes .NET and COM collections - Index (
⌷
) is indexing as a function - Depth (
≡
) determines the nesting level (including uneven nesting) of general arrays - Match (
≡
) compares the shape and contents of two arrays - Not Match (
≢
) is the negation of the above - Tally (
≢
) gives the length of the leading axis as a scalar - Unique mask (nub sieve) (
≠
) indicates the first occurrence of each unique major cell - Where (
⍸
) is a primitive of the age-old/⍳⍴
idiom, extended to higher rank arrays and non-negative integer values - Interval Index (
⍸
) efficiently determines into which buckets do values fall - Nest (enclose-if-simple) and Partition (
⊆
) for APL-2 style partitioning
New primitive operators
- Power operator (
⍣
) iterates a fixed number of times or until a condition is true - Commute (
⍨
) simplifies many expressions - Constant (
⍨
) turns any value into a function - At (
@
) is a way to amend elements of an array in-place without side effects - Bind (
∘
) (curry) an argument to a dyadic function, producing a monadic function - Beside (
∘
) is basic function composition;X f∘g Y ←→ X f g Y
- Atop (
⍤
) is a common function composition;X f⍤g Y ←→ f X g Y
- Over (
⍥
) is a common function composition;X f⍥g Y ←→ (g X) f g Y
- Behind (
⍛
) expresses common patternsX f⍛g Y ←→ (f X)g Y
andf⍛g Y ←→ (f Y)g Y
- Rank (
⍤
) applies functions to sub-arrays of a certain rank - Key (
⌸
) makes it easy to do things like group-by from SQL and other database systems - Stencil (
⌺
) makes it easy to do stencil code for simulations, image processing, cellular automata, and more - Variant (
⍠
) supplies extra parameters to system functions - Spawn (
&
) provides simple access to parallel threads
Lambdas (dfns)
A dfn is an alternative way to define a function or operator with a lightweight, optionally inline, notation.
- Intro
- Details
- Operators
- The dfns workspace (collection of categorised utilities with extensive comments and notes)
Tacit programming
Tacit programming, also called point-free style, refers to usage of functions that are defined in terms of implicit arguments. This is in contrast to the explicit use of arguments in dfns and tradfns (“defined functions”).