Got a minute? — Try APL!

APL is an array-oriented programming language that will change the way you think about problems and data. With a powerful, concise syntax, it lets you develop shorter programs that enable you to think more about the problem you're trying to solve than how to express it to a computer.

TryAPL runs on Dyalog, which you can download for free, or try it now by entering an expression (use the language bar above to type the special APL symbols), or clicking one of these expressions, followed by Enter, to see it in action:
2 + 2 No points for guessing this
4 2 3 + 8 5 7 Functions apply to arrays

⍳10 Generate the first ten integers
+/⍳100000 Sum the first 100 000 integers
×/⍳10 A long, slow way to write !10

Avg←{(+⌿⍵)÷≢⍵} Average is the sum divided by the count
Avg 1 6 3 4 … and apply it

throws←?10000⍴6 Store 10 000 dice throws
+/1=throws Of 10 000 throws, how many 1s?
+/(⍳6)∘.=throws Frequency of all 6 possibilities

'Hello, World!' Not just about maths!
{⍺,≢⍵}⌸'Mississippi' See?

What can APL do for you?

Are you a Problem Solver (a domain or subject matter expert with problems to solve) or a Programmer (someone who translates those solutions into a computer-executable format)? Problem Solvers benefit from APL's ability to concisely express advanced concepts without getting bogged down with a lot of computerese syntax. Programmers benefit from APL's productivity and brevity. Shorter programs means quicker development time and less code to maintain and debug.

In either case, concepts that take several lines of code in other languages can often be reduced to a few characters in APL. You'll quickly find that APL's symbols are organized in a logical, mnemonic manner that makes it easy to express advanced concepts clearly and concisely, and makes it easy to learn too. Move to the Learn tab and get started or visit the Primer tab to explore on your own!!


Cheat Sheet

Primitives

Use the language bar above to insert glyphs. Click on a glyph below to print basic usage and how to type it. Enter ]help followed by a symbol for details; for example ]help +.

Mathematics

Logic and Comparison

Structural

Selection and Set Operations

Search and Ordering

Operators

Miscellaneous

Additional features

The below subset of Dyalog's functionality is also supported in TryAPL. Enter for example ]help ]display for details:

Listing

]Display ⍳2 3 fully visualise array's structure
)VARS  list variable names
)FNS  list function names
)OPS  list operator names

Undoing Assignments

)CLEAR  clear workspace
)ERASE  name delete name(s)

Settings

⎕CT Comparison Tolerance
⎕DIV Division Method
⎕FR Floating-Point Representation
⎕IO Index Origin
⎕PP Print Precision
⎕RL Random Link

Definition

⎕AT Attributes
⎕CR Canonical Representation
⎕FX Fix Definition
⎕NR Nested Representation
⎕VR Vector Representation

Information

⎕DR Data Representation
⎕NC Name Class
⎕NL Name List
⎕SIZE Size of Object
⎕TS Time Stamp

Text Manipulation

⎕C Case Convert
⎕FMT Format
⎕R Replace
⎕S Search
⎕VFI Verify & Fix Input

Data Conversion

⎕DR Data Representation
⎕DT Date-time Convert
⎕JSON JSON Convert
⎕UCS Unicode Convert
⎕XML XML Convert

Other

⎕A Alphabetic Characters
⎕D Digits
⎕DL Delay

Help and About

Primitives

Use the language bar above to insert glyphs. Click on a glyph in the Primer tab to print basic usage and how to type it. Enter ]help followed by a symbol for details; for example ]help +.

Use the language bar above to insert glyphs. Hovering over a symbol in the language bar, or clicking on it in the Primer tab, will show: More information on entering APL symbols using your keyboard can be found on the APL Wiki.

Shortcut keys

EnterExecute current line
Shift+EscapeClear current line
Ctrl+Shift+Backspace or Alt+UpPrevious input
Ctrl+Shift+Enter or Alt+DownNext input
Access-key hOpen language help
Access-key zZoom right pane
Access-key lPermalink in URL bar
Access-key bUse black theme
Access-key wUse white theme

You can navigate the tabs using the keyboard:

Access-key iOpen and focus on Intro tab
Tab Focus on next tab
Shift+Tab Focus on previous tab
 Space Select focused tab

While running a notebook:

Access-key sStop current
Access-key rRestart current
Access-key pPrevious step
Access-key nNext step

About TryAPL

TryAPL free open source software and consists of a JavaScript front-end sending requests to a state-less Jarvis back-end which uses Safe Execute for Dyalog APL under Docker. Dyalog APL runs under Linux, including Raspberry Pi, Microsoft Windows, and macOS.

The back-end is available for direct use too. This means that anyone can write a new front-end or otherwise avail themselves of the computation engine. The simple API is described on APL Wiki.

The Learn tab's lessons are Jupyter Notebooks documents and can be used locally. We welcome submissions of notebooks for inclusion in TryAPL, as well as reports of anomalies, suggestions, criticisms, and comments to tryapl@dyalog.com.

Limitations

TryAPL has limited support for multi-line input. Lines that form a block with the previous line must begin with a tab character (U+09) which is automatically inserted if a line or block is missing closing one or more braces (}). For tradfns, and multi-line control structures, continue the current block using Alt+Enter. Press Esc to leave multi-line input mode.

Output, whether using ⎕← (other than at the beginning of a statement), ⍞←, or implicit output, is not supported.

To protect the server, expressions are checked against a whitelist while , , , , and ⎕FX have limited functionality. All supported quad-names, system and user commands are listed on the Primer tab.

Space and time limits can be queried with ]State. Exceeding the maximum time for execution of an expression causes the execution to be cancelled and the workspace will remain as it was before the expression was entered.

When using TryAPL, your workspace is automatically saved to local storage in your web browser. No data is stored on our servers; it is only sent across the network when you execute code. Manage your data from the File tab.

Credits

ImplementationBrian Becker
DesignBrian McCormick
Additional tutorialsWill Robertson
ReimplementationRichard Park
RedesignAdám Brudzewsky
InspirationJoel Hough
IdeasJohn Scholes, Andy Shiers, Roger Hui, John Daintree
DomainShaun Gilchrist
APL web serviceJarvis
APL whitelistSafe Execute
Split panesSplit.js
Text fontNunito
MarkdownMarked.js
FormulasMathJax

Sharing code

Access-key l will generate a shareable link in the URL bar for the line of code indicated by your text cursor.

Workspace Data

By default, your workspace is not saved between page visits, unless you opt in:

If the tickbox above is checked, then your workspace is automatically saved in your browser. You can always save your workspace to disk manually ― see below. No data is ever stored on our servers; it is only sent across the network when you execute code.

If the URL contains the clear parameter (tryapl.org?clear) then you will have a clear workspace and changes will not be saved. Removing the clear parameter will restore the data, if it exists and the checkbox above is ticked.

You can download your workspace as a .tryapl file:

You can upload a .tryapl workspace from your computer or load it from a URL:

 Load failed!