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?
+ - ×ばつ ÷ * ⍟ ⌈ ⌊ |
Grading and Sorting: ⍋ ⍒
Modifying Rank and Depth: ↑ ↓ ⊂ ⊃
Random Numbers: ?
Boolean Functions and Boolean Algebra: ∧ ∨ ⍱ ⍲ etc.
Comparison Functions: < ≤ = ≥ > ≠
Reduce and Scan: / \
Viewing lesson:
]help followed by a symbol for details; for example ]help +.
]help ]display for details:
]Display ⍳2 3 fully visualise array's structure)VARS list variable names)FNS list function names)OPS list operator names
)CLEAR clear workspace)ERASE name delete name(s)⎕CT Comparison Tolerance ⎕DIV Division Method ⎕FR Floating-Point Representation ⎕IO Index Origin ⎕PP Print Precision ⎕RL Random Link
⎕AT Attributes ⎕CR Canonical Representation ⎕FX Fix Definition ⎕NR Nested Representation ⎕VR Vector Representation ⎕DR Data Representation ⎕NC Name Class ⎕NL Name List ⎕SIZE Size of Object ⎕TS Time Stamp
⎕C Case Convert ⎕FMT Format ⎕R Replace ⎕S Search ⎕VFI Verify & Fix Input
⎕DR Data Representation ⎕DT Date-time Convert ⎕JSON JSON Convert ⎕UCS Unicode Convert ⎕XML XML Convert
⎕A Alphabetic Characters ⎕D Digits ⎕DL Delay ]help followed by a symbol for details; for example ]help +.
← symbol.You can navigate the tabs using the keyboard:
While running a notebook:
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.
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.
Access-key l will generate a shareable link in the URL bar for the line of code indicated by your text cursor.
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.
⎕NL-⍳9 to see which names are used in your workspace.
)CLEAR to remove all names from your workspace.
)ERASE name to remove name from your workspace.
)SAVE or the download button below to save your workspace as a .tryapl file.
)LOAD or the upload button below to load a .tryapl file.
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.
Share a TryAPL link that loads a workspace with tryapl.org?ws=[URL] or a notebook with tryapl.org?nb=[URL].
You can download your workspace as a .tryapl file:
You can upload a .tryapl workspace from your computer or load it from a URL:
Loading another workspace will overwrite your current workspace.
Use the Download… button to save your workspace now.