APL Language
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 1
s 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
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