Main Page/JPlayground

From J Wiki
Jump to navigation Jump to search

J Playground Shortcuts

The J Playground runs an interactive J session.

To try it out, https://jsoftware.github.io/j-playground/bin/html2/

J Playground is a browser accessible version of J

There are two windows: Term, an interactive console, and Edit, a script editor. The windows can be resized and flipped to be stacked vertically.

Term

The Term window lets you type in and run J expressions.

  • if the cursor is on the last line of the display, press Enter to execute it.
  • if the cursor is on a line above the last line of the display, press Enter to copy it to the end of the display. You can then edit it and press Enter to execute it.

The window can be edited as you wish, for example to delete unwanted output.

The input log can be accessed either

  • by pressing the Ctrl+Shift up/down cursor keys. This steps through the inputs.
  • by pressing Ctrl+D or selecting menu View|Input Log. This shows a popup menu, where selecting an entry copies it to the end of the display.

Edit

The Edit window is for entering one or more J expressions for later execution.

You can select from the Examples menu to populate the Edit window with typical expressions, or enter your own expressions.

To run the current line, put the cursor on it and press Ctrl+Enter or Ctrl+Shift+Enter. The difference is that when the expression is an assignment, Ctrl+Enter has no output while Ctrl+Shift+Enter displays the assigned value.

You can run through all the J expressions in a window by holding down Ctrl or Ctrl+Shift and repeatedly pressing Enter. Alternatively, select menu Edit Run|All Lines.

If the current line starts a multi-line definition, the entire definition is read in.

Context Sensitive

Context sensitive help is available for J language primitives.

In either window, select the primitive, or put the cursor inside or to the left of a primitive. Press Ctrl+F1 for the vocabulary definition.

For example, with the cursor inside i. this will show the definition of Integers.

Also, in the Term window, put the cursor spaced out to the left or right of an expression, then press Ctrl+F1 to output J word formation on the line, e.g.

    2 3 4 +/ i. 5
 ┌─────┬─┬─┬──┬─┐
 │2 3 4│+│/│i.│5│
 └─────┴─┴─┴──┴─┘