DYNA Fall 2025: 29-30 September. More info

APL Language

APL began as a notation invented by Kenneth E. Iverson, a professor at Harvard University, to teach courses on automatic data processing – a precursor to modern computer science.

 

It was later implemented as a programming language, initially by IBM and then many others and has evolved over the years. Dyalog APL includes many modern conveniences which anybody learning computer programming these days will be familiar with, such as if-else and for-while control structures, object-oriented features such as classes and namespaces, and anonymous lambda functions.

 

Its concise syntax and focus on collections makes it very powerful. Instead of breaking problems down into tiny steps, APL encourages you to think in terms of working on entire data structures at once, so you can express complex algorithms in remarkably few lines of code. Many programmers find that once they embrace APL thinking, they discover solutions that would be cumbersome in traditional languages.

Remarkably Concise

Simple syntax and symbols used to represent common operations on data allow users to write and adapt short and elegant expressions for all kinds of purposes. Commonly used patterns and expressions are called “idioms”.

⍝ Mean average
      (+⌿÷≢)3 1 4 1 5
2.8
⍝ Windowed moving average
      2(+⌿÷⊣)3 1 4 1 5
2 2.5 2.5 3
⍝ Remove leading hyphens
      {⍵⌿⍨~∧\'-'=⍵}'---sample text---'
sample text---
⍝ Remove trailing hyphens
      {⍵⌿⍨~⌽∧\⌽'-'=⍵}'---sample text---'
---sample text

Inherently Efficient / Naturally Performant

Often completely branchless, APL expressions present a high degree of mechanical sympathy ideally suited to SIMD processing. APL can offer high programmer efficiency, as well as all-out execution speed by leveraging modern processors  with dedicated vector-oriented instructions.

⍝ Which are vowels?
      'aesthetic'∊'aeiou' 
1 1 0 0 0 1 0 1 0
⍝ Only leading vowels
      ∧\'aesthetic'∊'aeiou' 
1 1 0 0 0 0 0 0 0
⍝ Array indexing 
      'DYALOG APL'[5 4 1 7 9 3 10]
OLD PAL
      {'small' 'medium' 'large'[0 15 40⍸⍵]}5 5 45
┌─────┬─────┬─────┐
│small│small│large│
└─────┴─────┴─────┘

Highly Expressive

Common patterns in APL can be applied in many use cases. Conversely, there are often many ways to tackle the same problem. The small code size makes for a low cost to trying several approaches and seeing what works best for your particular application.

A windowed plus-reduction gives the sum of each set of three consecutive numbers.

      3+/3 1 4 1 5 9 2 6 5 3 5
8 6 10 15 16 17 13 14 13

A windowed catenate-reduction returns the groupings as a list of lists.

      3,/3 1 4 1 5 9 2 6 5 3 5
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
│3 1 4│1 4 1│4 1 5│1 5 9│5 9 2│9 2 6│2 6 5│6 5 3│5 3 5│
└─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘

A windowed less-than-reduction keeps the first 1 in each consecutive group of 1s in a Boolean array.

      1,2</' '≠'mark the start of each word'
1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0

Shockingly Simple

Primitive functions and operators are represented by symbols that mnemonically suggest their meanings.

      ≢'apples'
6
      ≢'apples'
6
      ⌽'reverse'
esrever
      3⌽'rotate'
aterot
      ⌈3.141
4
      3⌈5
5

Dyalog APL

Dyalog is a modern, batteries-included implementation of APL. The Dyalog interpreter has been tuned for high performance in common use cases.
 
The interpreter comes with a wide range of features to facilitate effective application development, and allows you to mix-and-match different programming paradigms to tackle different problems and express ideas naturally at different levels of your application. While a compiler or financial calculator might benefit from a linear data-flow pipeline, a business application can utilise structured programming techniques, with core computations leveraging the high-performance, mathematically-oriented primitive functions and operators.
 
Dyalog is well suited to exploration of data and algorithms. Its carefully chosen set of primitive functions and operators, together with system functions, can be combined to solve a wide range of problems across a variety of domains. It is particularly appropriate for data cleaning, preparation and format conversion in custom, bespoke, irregular or unusual data sources. Dyalog’s concise, expressive syntax makes it well-suited for involving subject matter experts in code development and review, and its flexibility is valuable when algorithms are still evolving or data structures are large, irregular, or multi-dimensional.
 
Tools are available at both the built-in language level and as importable utilities to help with all kinds of tasks from reading and writing data from external data sources such as files, databases and the internet as well as converting between data formats and interfacing with non-APL systems.

Interactive development and debugging

Dyalog provides Interactive Development Environments (IDEs) for Microsoft Windows, macOS and Linux.

  • iteratively develop solutions
  • interactively debug and quickly address issues
  • connect with remote systems across supported platforms

Connect and integrate

Connect and integrate with other languages, libraries, and systems.

  • Send requests to web services
  • Compiled libraries (.dll, .so, .dylib) written in C or other languages
  • Microsoft Office products including Excel
  • SQL databases

Flexible deployment

Deploy your applications with ease using Dyalog as scripts, standalone executables, or in cloud services like AWS.

  • Desktop
  • Shell scripts
  • Cloud
  • Utilities

I am using the Products Master Page. You don’t need to tell Mike about this message, he knows!

Get Support

Technical advice and assistance on all aspects of Dyalog usage is available by e-mail (support@dyalog.com) and/or telephone (+44 1256 830030 – limited to U.K. office hours). Limited advice on design and coding is available, but is not intended to replace the use of the printed and on-line documentation. Except when reporting an issue with the software, users are encouraged to seek advice from the user community via the Dyalog Forum (reading the content of the forums does not require membership).

Search our website...