SliP Language Reference

Version 2.3.0, 2026-08-21. SliP is a programmable symbolic calculator. Implementation in C++/ is authoritative. See also the Tutorial and changelog.


1. Two modes

ModeCheckboxInput
Calculatorprog offOne expression per line (§2)
Programmingprog onFull SliP top-level forms; // comments stripped

Both modes use a fresh context on every RUN. Bindings from earlier forms or lines in the source are visible to later ones during that run. The source is the complete, reproducible program; bindings are not carried from one RUN to the next.

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 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

The WASM build adds Canvas/WebGL operators (canvas, fill, stroke, path2D, shader helpers, …). They are not available in the CLI or native apps. Existing canvases are removed at the start of each RUN.

The top bar includes editable SliP graphics programs: Mandelbrot (WebGL), Koch, Complex orbit, Barnsley fern, and Lorenz attractor (Canvas 2D). 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.