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 of data (arrays) 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.
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.
Mean average
(+⌿÷≢)3 1 4 1 5
2.8
Windowed moving average
2(+⌿÷⊣)3 1 4 1 5
2 2.5 2.5 3
Weighted average
1 3 5 4 2(+.×÷+/⍤⊣)3 1 4 1 5
2.666666667
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
Remove vowels
text←'this text is made of characters'
text⌿⍨~text∊'aeiou'
ths txt s md f chrctrs
Remove interior vowels
text←'can you read this?'
text⌿⍨(0,0,⍨3∧/' '≠text)⍲text∊'aeiou'
cn yu rd ths?
Uppercase vowels
text←'uppercase vowels'
('AEIOU',text)[('aeiou',text)⍳text]
UppErcAsE vOwEls
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
@ (At) operator applies a function as specified locations. 1⎕C@(1,2</' '∘≠)'title case text'
Title Case Text
Simple
Primitive functions and operators are represented by symbols that mnemonically suggest their meanings.
≢'apples'
6
3↑'apples'
app
3↓'apples'
les
⌽'reverse'
esrever
3⌽'rotate'
aterot
⌈3.141
4
3⌈5
5
Dyalog APL
Language Extensions
Dyalog APL continues to evolve, from introducing primitive functions and operators to system functions and general programming constructs, developed carefully over decades of experience together with our users. Dyalog-specific features include:
- Sort any array with Total Array Ordering
- Object-oriented features such as namespaces and classes
- New and extended primitive functions such as Where and Interval-index (⍸), Index-of (⍳)
- Operators for common usage patterns including the Power operator (⍣) and Key (⌸)
- System functions for easy data import and export such as ⎕CSV, ⎕NGET and ⎕NPUT
- Dfns, lambda-style functions for functional programming
Connectivity and Integration
Dyalog-based software can be deployed as scripts, graphical desktop applications, web applications and services hosted in the cloud, or integrated as part of an existing technology stack.
- Provide and consume web services
- Read, write and manage SQL databases
- Create compiled libraries (.dll, .so, .dylib), and use those written in C or other languages
- Use and create .NET assemblies to interoperate with C# and other .NET languages
- Talk to live-running Python and R systems
- Interface directly with Microsoft Excel and other Office products for automation
Data-parallel and Asynchronous Programming
APL’s array-oriented primitive functions and operators are inherently data-parallel, and take advantage of SIMD optimisations on compatible hardware.
Dyalog also provides constructs for asynchronous programming with the Spawn operator (&) for green threads, and Isolates or .NET Tasks to utilise multiple processes.
CALL TO ACTION HERE
Something like “Get Started Now” or “Learn Dyalog APL“.