SliP is a programmable symbolic calculator. Start with ordinary calculations, then add names, functions, lists, matrices, JSON, and browser graphics without changing languages.
Open the calculator · Language reference
The center of the calculator is stacked vertically:
The keypad is on the right. Its RUN key evaluates the whole source. The prog checkbox switches between Calculator and Programming modes. Settings are in the drawer on the left. Use the chevrons in the top bar to open or close either side panel.
You can also run with ⌘↩ on macOS or Ctrl↩ on Windows and Linux.
Leave prog unchecked. Each non-empty line is one calculator expression. Press RUN after entering:
1 + 2 × 3 cosπ [1 2 3] + 10
The result area shows each expression followed by its value:
7 -1 [ [ 1 2 3 ] 10 ]
A bad line reports an error, but the remaining lines still run. Names created by an earlier line are available to later lines during the same run:
'r = 2 2πr
This produces 2 and 12.5663706143592.
Use the keypad for symbols that are awkward to type. With the default input settings, typing * inserts ×, and / inserts ÷.
2 × 3 ÷ ( 4 + 5 - 6 ) // → 2 2 3 4 // → 24
Adjacent numeric values multiply implicitly, which is why 2πr works.
| Symbol | Meaning | ASCII alias |
|---|---|---|
π | Pi | pi |
𝑒 | Euler's number | euler |
∞ | Infinity | inf |
ASCII e remains an ordinary name. Common functions use prefix syntax:
cosπ // → -1 sqrt 9 // → 3 atan2[ 1 1 ] // → 0.785398163397448 pow[ 2 3 ] // → 8 hypot[ 3 4 ] // → 5 max[ 3 2 1 ] // → 3
¤ returns a random number in [0, 1). Use random[ low high ] for another range. These random values are not suitable for cryptography.
Check prog when the source contains complete SliP forms that span lines. Programming mode parses the source as a sequence of top-level forms and stops at the first error, because later forms commonly depend on earlier ones.
Calculator mode adds parentheses around each line for you. Programming mode does not, so complete expressions are written explicitly:
( 'r = 2 ) ( 2 π r )
A quoted expression can be bound to a name. @ reads the current argument, and : applies its left side to its right side:
( 'double = '( @ × 2 ) ) ( 3 : double ) // → 6
Here, quote (') returns the following object without evaluating it immediately.
The empty list [] is false; other values are truthy. Comparisons return T or []. The ? operator selects one of two deferred branches:
( 'factorial = '(
@ == 0 ? [
1
( @ × ( @ - 1 ):factorial )
]
) )
( 4 : factorial ) // → 24
Square brackets make a literal list. Braces evaluate sentences in a new child context and return their values:
{ ( 'a = 2 )
( 'b = 3 )
( a + b )
}
// → [ 2 3 5 ]
Bindings made inside { } do not escape it. Guillemets evaluate in the current context, so their bindings remain:
« ( 'a = 2 )
( 'b = 3 )
( a + b )
»
// → [ 2 3 5 ]
¶ returns a dictionary snapshot of the current context.
Strings can use double quotes or backticks. Backticks are convenient when the text contains double quotes:
"hello" `a string with "quotes"`
byJSON converts JSON text to SliP values. A dictionary accepts either a string or a quoted name as its key:
( 'data = `{"radius":2,"name":"circle"}`:byJSON )
( data:'radius ) // → 2
( data:"name" ) // → "circle"
The buttons in the top bar load ready-to-run examples. Calculator and Code demonstrate the two evaluation modes. The graphics examples automatically enable prog:
zₙ₊₁ = zₙ² + c; edit R and I.DEPTH.SIGMA, RHO, BETA, or DT.Press RUN after changing a sample. Drag a canvas to move it, or double-click it to close it. Graphics operators are available in the Web version; native apps currently focus on calculation and programming.
Open the Language reference for the complete token, operator, precedence, mode, and implementation rules. The examples in the top bar are also ordinary editable SliP source—changing them is often the quickest way to learn.
Have fun exploring.