SliP Language Reference

Version 2.0.0, 2026-07-25. SliP is a programmable symbolic calculator. Implementation in C++/ is authoritative. See also Tutorial.


1. Two modes

ModeCheckboxInput
CalculatorProgramming mode offOne expression per line (§2)
ProgrammingProgramming mode onFull SliP; // comments stripped

Both modes use a fresh context on each CALCULATE by default. Bindings from earlier lines in the source are visible to later lines in the same run. Check Keep session between runs in the settings panel to retain bindings across runs.

2. Calculator (sugared) mode

Line wrapping

Each non-empty line expr (trimmed, comment stripped) is evaluated as:

( expr )

Implicit multiply

2 3 4   →  24
2πr     →  2 × π × r
cosπ    →  cos(π)

Function calls

sin(0)        sin applied to 0
atan2[ 1 1 ]  two-argument form
max[ 3 2 1 ]  list argument

Assignment

'r = 2

becomes ( 'r = 2 ) and binds r for the rest of that CALCULATE run.

3. Names and tokens

4. Evaluation

Sentence ( … )

  1. Infix split first: the lowest-priority operator splits the raw sentence; recurse both sides. Equal priority → rightmost wins, except right-associative = and ,.
  2. Prefix / quote pass (right to left) runs inside infix-free segments. A prefix absorbs a following run of bare numerics: sin 2πsin( 2 × π ), but sin(2) πsin( 2 ) × π.
  3. Adjacent numerics with no operator → multiply

Operands evaluate left to right, and && || ¿ short-circuit: the right side is untouched when the left side decides the result.

Blocks

FormContextEffect
{ … }New child contextSequential; returns list of results
« … »Same contextSequential (not parallel threads); bindings persist
∥ '[ … ]Own child context per branchConcurrent; results in source order

Parallel

∥ '[ s₁ s₂ … ] evaluates the elements concurrently, each isolated in its own child context, and collects the results in source order:

( ∥ '[ ( 1 + 1 ) ( 2 + 2 ) ( 3 + 3 ) ]  )  →  [ 2 4 6 ]

( 'z = 1 )
( ∥ '[ ( 'z = 99 ) ( z ) ] )               →  [ 99 1 ]   second branch still sees 1
( z )                                      →  1          caller untouched

( 5 : '( ∥ '[ ( @ + 1 ) ( @ × 2 ) ] ) )    →  [ 6 10 ]   @ is seeded per branch

Branches cannot observe each other, so the value equals sequential evaluation; when several branches fail, the earliest in source order reports. Use « » when the sentences must share bindings.

On this page runs sequentially. Browser threads need SharedArrayBuffer, which needs COOP/COEP headers the static host cannot send. The native CLI build uses real threads. The value is the same either way — only elapsed time differs.

Truth

ValueMeaningPrinted
[]Nil / false[]
non-emptyTruthyown REPR
from == etc.trueT

5. Context

6. Operators (summary)

Primitives

SymMeaning
@Stack top (for : apply)
£Stack as list
Context → Dict
Empty list
¤Random [0, 1)

Quote / prefix / unary

SymMeaning
'Quote
!Eval
# * $Length / CDR / last
; ¦Stdout / stderr print
~ ¬Bit / logical NOT
¡Throw
Evaluate a list's elements concurrently, isolated, in source order

Infix (priority low → loose)

PriOperators
0= assign (right-assoc)
10? ¿ if (¿ short-circuits)
20&& || ^^ (&& || short-circuit)
30 == <> < > <= >=
50§ , (, right-assoc)
60+ -
70· × ÷ / %
80& | ^
90: apply
100± . matrix cols / index

Comparisons bind tighter than && || ^^, so x > 0 && y > 0 reads as ( x > 0 ) && ( y > 0 ).

Apply :

arg : f pushes arg on the argument stack, evaluates f, then pops the stack. Use @ inside quoted functions to read the stack top.

Math (prefix)

sin cos tan log exp sqrt … — one arg.
atan2 pow random — two args via [ ].
hypot max min — list arg.

Random

¤                 →  uniform [0, 1)
random[ 1 2 ]     →  uniform [1, 2)

JSON

operand:toJSON · `` literal`:byJSON ``

7. Web graphics

WASM build adds Canvas/WebGL operators (canvas, fill, stroke, …). Not in CLI. Canvases are removed on each CALCULATE. The graphics surface is currently sample-driven rather than specified operator by operator.

8. Constants

∞  𝑒  π  γ  φ  log2e  log10e  ln2  ln10
ASCII aliasConstant
piπ
euler𝑒
inf

ASCII e remains an ordinary name.