SliP Language Reference

Draft 2026-07-04. 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 share one session context on the web until Reset context or reload.

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 in the session.

3. Names and tokens

4. Evaluation

Sentence ( … )

  1. Prefix / quote pass (right to left)
  2. Infix pass (lowest priority operator splits first)
  3. Adjacent numerics with no operator → multiply

Blocks

FormContextEffect
{ … }New child contextSequential; returns list of results
« … »Same contextSequential (not parallel threads); bindings persist

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

Infix (priority low → loose)

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

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.