Skip to main content

Language Basics

Squiggle supports some simple types and language features.

Numbers

Result:
4.32

Distributions

There are several ways of easily entering distributions. See the documentation on distributions for a complete API.

Result:
Distribution plot

Lists

Squiggle lists can accept items of any type, similar to those in Python. API.

Result:
0:
Distribution plot
1:
4
2:
true

Dictionaries

Squiggle dictionaries work similarly to Python dictionaries. API.

Result:
Distribution plot

Functions

Result:
function(t)
Chart for lambda(t=>internal code)

Conditionals

Result:
10

Anonymous Functions

Result:
function(t)
Chart for lambda(t=>internal code)

Comments

Result:
""

Pipes

Squiggle features data-first pipes. Functions in the standard library are organized to make this convenient.

Result:
Distribution plot

Standard Library

Squiggle features a simple standard libary.

Most functions are namespaced under their respective types to keep functionality distinct. Certain popular functions are usable without their namespaces.

For example,

Result:
""

Number Suffixes

Numbers support a few scientific notation suffixes.

suffixmultiplier
n10^-9
m10^-3
k10^3
M10^6
B,G10^9
T10^12
P10^15
Result:
Distribution plot