Useful Tips for Using Dyalog
This page contains tips that users have suggested would have been useful to know when they first started with APL. It should be read in conjunction with Getting Started.
To suggest a tip or tell us something that you wish you’d known when you first started, send an email to tips@dyalog.com for consideration for inclusion on this page.
Getting Help
- The
]Help
user command opens the online documentation.- Entering ]Help followed by a symbol, user command, or I-beam. opens the online documentation page for it.
- In the Microsoft Windows IDE or Ride, place the cursor on a symbol or other built-in and press F1 to open the documentation page for it.
- In the Microsoft Windows IDE or Ride, hover your mouse over a glyph in the language bar for a hint on how to type it and a quick overview of what it does.
Editing
- Try the F1 tip above for
)ED
to learn how to quickly create new items of various types. - Use Shift + Enter to edit a name.
)ED "file:///path/file.ext"
lets you edit plain-text files.- Load APL functions/operators/objects from plain-text files with
2⎕FIX'/path/file.ext'
.
Debugging and Meta Information
- Use Ctrl + Enter to trace into a function and execute it one line at a time.
- Use Shift + Enter with the cursor on white space to edit a suspended function.
- Use Ctrl + Break to stop when an expression runs for a long time or results in long output in the session (alternatively, select Interrupt from the Session’s Action menu).
- Get all the technical details of the last error or event with
⎕JSON⍠'Compact'0⊢⎕DMX
. - Enter
'tc'⎕CY'dfns'
and then inserttc
to the right of any function that you want to inspect
Language Bar
Right click on the language bar and select Use the session font to have the language bar font match the session font.
Shortcuts
- Use Ctrl + Shift + Backspace and Ctrl + Shift + Enter to scroll backwards and forwards through your input history (they can also be used as Undo and Redo in the Edit window.
- Many in-built functionalities have neither menu items nor keyboard shortcuts assigned by default. To configure keyboard short-cuts, go to Options > Configure> Keyboard Shortcuts in the Microsoft Windows IDE or click the keyboard icon (⌨) in Ride.
- In the Microsoft Windows IDE, you can use the copy and paste buttons on the Object (not Edit) toolbar to copy and paste tables as matrices, documents as vectors of character vectors, and images as bitmap objects.
Restore Ctrl key Functionality
If your input method does not use Ctrl as an APL shifting key (see Typing APL), you might want to set keyboard shortcuts that use Ctrl similarly to those in many text editors and word processing applications.
Shortcuts are denoted by two letter codes. In Dyalog for Microsoft Windows, the shortcuts can be retrieved using the ⎕KL
system function. In the menu bar, go to Options → Configure and go to the Keyboard Shortcuts tab. From there, click on a row in the shortcuts table and type the desired keyboard shortcut to set it.
– Set SA to Ctrl+A to select all text in the session, edit and trace windows
– Set SC to Ctrl+F to search through the session log (use ]Locate
or Tools → Search to search through code)
– Set FX to Ctrl+S to save changes in the editor without closing it
– Set CP to Ctrl+C to copy selected text to the clipboard
– Set CT to Ctrl+X to cut selected text to the clipboard
– Set PT to Ctrl+V to paste from the clipboard
– Ctrl+Z and Ctrl+Y can be set to BK and FD to undo and redo changes made in the editor; be aware that they are the same shortcut codes for scrolling backwards and forwards through input history and their defaults are often referenced in tutorials. Skipping over a line of code in the tracer uses the FD shortcut.
If you use the Dyalog IME for Microsoft Windows, you can still use Ctrl+X, C and V for Cut, Copy and Paste. Start Dyalog, open the Options menu and select Configure. Then, in the Unicode Input tab select Dyalog APL IME from the dropdown menu and click on Configure Layout. Ensure that Use Ctrl+X, C, V for clipboard is selected and click OK.
Display Forms
- The settings in this section can be made permanent by saving your session:
- In the Microsoft Windows IDE: Session > Save.
- Within any Dyalog Session:
2⎕NQ⎕SE'FileWrite'
.
]Rows on -fold=3
will let you scroll horizontally and trim large outputs so that they don’t flood your screen vertically.
Boxing
- Turn boxing on to make the display of nested arrays more clear:
]Box on Was OFF ⍳2 3 ┌───┬───┬───┐ │1 1│1 2│1 3│ ├───┼───┼───┤ │2 1│2 2│2 3│ └───┴───┴───┘
- With the
trains
modifier, you can display function trains with a tree structure:]Box -trains=tree Was -trains=box +⌿÷≢ ┌─┼─┐ ⌿ ÷ ≢ ┌─┘ +
- With the
fns
modifier, nested arrays will have boxed display even if they are printed to the session from within functions:PrintShape←{⍴⎕←⍵} PrintShape ⍳1 3 1 1 1 2 1 3 1 3 ]Box -fns=on Was -fns=off PrintShape ⍳1 3 ┌───┬───┬───┐ │1 1│1 2│1 3│ └───┴───┴───┘ 1 3
- With the
style
modifier you can get a more verbose view, including hints for axes and data types:]Box -style=max ┌→─────────────┐ │Was -style=min│ └──────────────┘ ⊂'APL' ┌───────┐ │ ┌→──┐ │ │ │APL│ │ │ └───┘ │ └∊──────┘
- See all the options with
]Box -??
Quick Utilities
]Map
displays the content and structure of your workspace.]Plot <data>
draws simple graphs of your data (seePlot -??
for details).]Open <filename>
opens a file in its default application.]CD <dir>
lets you change directory from inside an APL Session.- In general, help for user commands can be found with
]<Command> -?
. - Use
⎕SE.Dyalog.Utils.repObj <myArray>
to generate an expression for (almost) any given array. - Use the workspace explorer to see a tree view of your workspace:
- In the Microsoft Windows IDE, go to Tools > Explorer.
- In Ride (the default interface on macOS, optional interface on other platforms), go to View > Show Workspace Explorer.