Skip to content

1.1 Creating content

Adám Brudzewsky edited this page Sep 20, 2018 · 5 revisions

Note: This only applies to offline usage.

Editing and creating cells

Click on any code to begin editing it, then press Ctrl+Enter to execute the code.

Use the ➕︎ button to insert a new code cell. You can switch a cell contain explanations, comments, etc. by selecting Markdown from the drop-down saying Code∨. Additional commands can be found by clicking the ⌨︎ button.

Defining functions

Single-line dfns and tacit functions may be defined among other code in a code cell:

AddNext←{⍵,+/¯2↑⍵}
Fibonacci←AddNext/⌽∘⍳
Fibonacci 10

Tradfns may be defined in a cell by beginning the first line with a and having a sole after the last line:

∇Greet name
 ⎕←'Hello, ',name
∇

To define a multi-line dfn, begin a Code cell with the line ]dinput. For example:

]dinput
root←{
    ⍺←2
    ⍵*÷⍺
}

Rich content

You can indicate that the result of a statement should be rendered as HTML by using the ]html user command:

p←'<p>Please:</p>'
b←'<button onclick="alert(''Thank you!'')">Click</button>'
]html p,b

You can plot data with with the ]plot user command:

x←(⍳100)÷20
y←(⊢*÷)x
]plot y x

Choose chart type with the -type= modifier:

]plot 3 1 4 1 6 -type=pie

Next ▸

Clone this wiki locally