Examples
-
+
@@ -343,7 +346,7 @@ Creates a [triangular distribution](https://en.wikipedia.org/wiki/Triangular_dis
-## FromList
+## SampleSet.fromList
`SampleSet.fromList(samples:number[])`
@@ -367,3 +370,41 @@ Creates a sample set distribution using an array of samples.
specificity.
+
+## PointSet.makeContinuous
+
+`PointSet.makeContinuous(points:{x: number, y: number})`
+
+Creates a continuous point set distribution using a list of points.
+
+
+
+### Arguments
+
+- `points`: An array of at least 3 coordinates.
+
+## PointSet.makeDiscrete
+
+`PointSet.makeDiscrete(points:{x: number, y: number})`
+
+Creates a discrete point set distribution using a list of points.
+
+
+
+### Arguments
+
+- `points`: An array of at least 1 coordinate.
diff --git a/packages/website/docs/Guides/Functions.mdx b/packages/website/docs/Guides/Functions.mdx
index 843cf888..4e57f23e 100644
--- a/packages/website/docs/Guides/Functions.mdx
+++ b/packages/website/docs/Guides/Functions.mdx
@@ -1,5 +1,5 @@
---
-title: "Distribution Functions"
+title: "Distributions: Key Functions"
sidebar_position: 3
---
@@ -181,7 +181,7 @@ The `sample(distribution)` samples a given distribution.
Recall the [three formats of distributions](https://develop--squiggle-documentation.netlify.app/docs/Discussions/Three-Types-Of-Distributions). We can force any distribution into `SampleSet` format
-
+
Or `PointSet` format
diff --git a/packages/website/docs/Guides/Language.mdx b/packages/website/docs/Guides/Language.mdx
index 90ee25b5..311ef6ba 100644
--- a/packages/website/docs/Guides/Language.mdx
+++ b/packages/website/docs/Guides/Language.mdx
@@ -5,50 +5,103 @@ title: Language Basics
import { SquiggleEditor } from "../../src/components/SquiggleEditor";
-## Expressions
+Squiggle supports some simple types and language features.
-### Numbers
+## Numbers
-### Distributions
+## Distributions
+
+There are several ways of easily entering distributions. See the [documentation](/docs/Api/Dist/) on distributions for a complete API.
-### Lists
+## Lists
+
+Squiggle lists can accept items of any type, similar to those in Python. [API](/docs/Api/List).
-
+## Dictionaries
-### Dictionaries
+Squiggle dictionaries work similarly to Python dictionaries. [API](/docs/Api/Dictionary).
-### Functions
+## Functions
-### Anonymous Functions
+## Anonymous Functions
-## See more
+## Comments
-- [Distribution creation](./DistributionCreation)
-- [Functions reference](./Functions)
-- [Gallery](../Discussions/Gallery)
+
+
+## Pipes
+
+Squiggle features [data-first](https://www.javierchavarri.com/data-first-and-data-last-a-comparison/) pipes. Functions in the standard library are organized to make this convenient.
+
+ truncateLeft(3) |> SampleSet.fromDist |> SampleSet.map({|r| r + 10})`}
+/>
+
+## Standard Library
+
+Squiggle features a simple [standard libary](/docs/Api/Dist).
+
+Most functions are namespaced under their respective types to keep functionality distinct. Certain popular functions are usable without their namespaces.
+
+For example,
+
+ SampleSet.fromList // namespaces required
+b = normal(5,2) // namespace not required
+c = 5 to 10 // namespace not required
+""`}
+/>
+
+## Number Prefixes
+
+Numbers support a few scientific notation prefixes.
+
+| prefix | multiplier |
+| ------ | ---------- |
+| n | 10^-9 |
+| m | 10^-3 |
+| k | 10^3 |
+| M | 10^6 |
+| B,G | 10^9 |
+| T | 10^12 |
+| P | 10^15 |
+
+
diff --git a/packages/website/docs/Internal/ImportIntoMdx.mdx b/packages/website/docs/Internal/ImportIntoMdx.mdx
new file mode 100644
index 00000000..683f9311
--- /dev/null
+++ b/packages/website/docs/Internal/ImportIntoMdx.mdx
@@ -0,0 +1,37 @@
+---
+title: How to import squiggle files into `.mdx` documents
+sidebar_position: 5
+---
+
+import { SquiggleEditorWithImportedBindings } from "../../src/components/SquiggleEditor";
+
+_Proof of concept_
+
+## Consider the following squiggle file
+
+In our docusaurus repo, we have a static asset called `demo.squiggle`. It looks like this
+
+```js
+x = 1 to 2
+y = {a: x, b: 1e1}
+f(t) = normal(t, 1.1)
+z = y.b * y.a
+```
+
+We can call `f(z)` upon the assignments in `demo.squiggle` like so:
+
+```jsx
+import { SquiggleEditorWithImportedBindings } from "../../src/components/SquiggleEditor";
+
+;
+```
+
+Which would then look exactly like
+
+
diff --git a/packages/website/docs/Introduction.md b/packages/website/docs/Introduction.md
deleted file mode 100644
index 22359de2..00000000
--- a/packages/website/docs/Introduction.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-sidebar_position: 1
-title: Introduction
----
-
-Squiggle is a simple programming language for intuitive probabilistic estimation. It's meant for quantitative forecasting and evaluations.
-
-The basics of Squiggle can be pretty simple and intuitive. The more advanced functionality can take some time to learn.
-
-## What Squiggle Is
-
-- A simple programming language for doing math with probability distributions
-- An embeddable language that can be used in Javascript applications
-- A tool to embed functions as forecasts that can be embedded in other applications
-
-## What Squiggle Is Not
-
-- A complete replacement for enterprise Risk Analysis tools (See Crystal Ball, @Risk, Lumina Analytica)
-- A Probabilistic Programming Language with backwards inference and sophisticated sampling algorithms. (See [PPLs](https://en.wikipedia.org/wiki/Probabilistic_programming))
-- A visual tool aimed at casual users (see Guesstimate, Causal)
-
-## Get started
-
-- [Gallery](./Discussions/Gallery)
-- [Squiggle playground](/playground)
-- [Language basics](./Guides/Language)
-- [Squiggle functions source of truth](./Guides/Functions)
-- [Known bugs](./Discussions/Bugs)
-- [Original lesswrong sequence](https://www.lesswrong.com/s/rDe8QE5NvXcZYzgZ3)
-- [Author your squiggle models as Observable notebooks](https://observablehq.com/@hazelfire/squiggle)
diff --git a/packages/website/docs/Overview.mdx b/packages/website/docs/Overview.mdx
new file mode 100644
index 00000000..d00ef749
--- /dev/null
+++ b/packages/website/docs/Overview.mdx
@@ -0,0 +1,119 @@
+---
+sidebar_position: 1
+title: Overview
+---
+
+import { SquiggleEditor } from "../src/components/SquiggleEditor";
+
+Squiggle is a minimalist programming language for probabilistic estimation. It's meant for intuitively-driven quantitative estimation instead of data analysis or data-driven statistical techniques.
+
+The basics of Squiggle are fairly straightforward. This can be enough for many models. The more advanced functionality can take some time to learn.
+
+## Simple example
+
+Say you're trying to estimate the number of piano tuners in New York City. You can build a simple model of this, like so.
+(Tip: This is interactive! Feel free to modify the code directly.)
+
+
+
+---
+
+Now let's take this a bit further. Let's imagine that you think that NYC will grow over time, and you'd like to estimate the number of piano tuners for every point in time for the next few years.
+
+
+
+If you haven't noticed yet, you can hover over the `populationAtTime` graph to see the distribution of population at different points in time.
+
+## Using Squiggle
+
+You can currently interact with Squiggle in a few ways:
+
+**[Playground](/playground)**
+The [Squiggle Playground](/playground) is a nice tool for working with small models and making prototypes. You can make simple shareable links, but you can't save models that change over time.
+
+**[Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=QURI.vscode-squiggle)**
+There's a simple [VS Code extension](https://marketplace.visualstudio.com/items?itemName=QURI.vscode-squiggle) for running and visualizing Squiggle code. We find that VS Code is a useful editor for managing larger Squiggle setups.
+
+**[Typescript Library](https://www.npmjs.com/package/@quri/squiggle-lang)**
+Squiggle is built using [Rescript](https://rescript-lang.org/), and is accessible via a simple Typescript library. You can use this library to either run Squiggle code in full, or to call select specific functions within Squiggle (though this latter functionality is very minimal).
+
+**[React Components Library](https://www.npmjs.com/package/@quri/squiggle-components)**
+All of the components used in the playground and documentation are available in a separate component NPM repo. You can see the full Storybook of components [here](https://squiggle-components.netlify.app).
+
+**[Observable](https://observablehq.com/@hazelfire/squiggle)**
+You can use Squiggle Components in Observable notebooks. Sam Nolan put together an exportable [Observable Notebook](https://observablehq.com/@hazelfire/squiggle) of the key components that you can directly import and use in your Observable notebooks.
+
+## Squiggle Vs. Other Tools
+
+### What Squiggle Is
+
+- A simple programming language for doing math with probability distributions.
+- An embeddable language that can be used in Javascript applications.
+- A tool to encode functions as forecasts that can be embedded in other applications.
+
+### What Squiggle Is Not
+
+- A complete replacement for enterprise Risk Analysis tools. (See [Crystal Ball](https://www.oracle.com/applications/crystalball/), [@Risk](https://www.palisade.com/risk/), [Lumina Analytica](https://lumina.com/))
+- A [probabilistic programming language](https://en.wikipedia.org/wiki/Probabilistic_programming). Squiggle does not support Bayesian inference.
+- A tool for substantial data analysis. (See programming languages like [Python](https://www.python.org/) or [Julia](https://julialang.org/))
+- A programming language for anything other than estimation.
+- A visually-driven tool. (See [Guesstimate](https://www.getguesstimate.com/) and [Causal](https://causal.app/))
+
+### Strengths
+
+- Simple and readable syntax, especially for dealing with probabilistic math.
+- Fast for relatively small models. Strong for rapid prototyping.
+- Optimized for using some numeric and symbolic approaches, not just Monte Carlo.
+- Embeddable in Javascript.
+- Free and open-source.
+
+### Weaknesses
+
+- Limited scientific capabilities.
+- Much slower than serious probabilistic programming languages on sizeable models.
+- Can't do Bayesian backwards inference.
+- Essentially no support for libraries or modules (yet).
+- Still very new, so a tiny ecosystem.
+- Still very new, so there are likely math bugs.
+- Generally not as easy to use as Guesstimate or Causal, especially for non programmers.
+
+## Organization
+
+Squiggle is one of the main projects of [The Quantified Uncertainty Research Institute](https://quantifieduncertainty.org/). QURI is a nonprofit funded primarily by [Effective Altruist](https://www.effectivealtruism.org/) donors.
diff --git a/packages/website/docusaurus.config.js b/packages/website/docusaurus.config.js
index dd1879fb..f48ac952 100644
--- a/packages/website/docusaurus.config.js
+++ b/packages/website/docusaurus.config.js
@@ -57,18 +57,18 @@ const config = {
hideOnScroll: true,
logo: {
alt: "Squiggle Logo",
- src: "img/quri-logo.png",
+ src: "img/squiggle-logo.png",
},
items: [
{
type: "doc",
- docId: "Introduction",
+ docId: "Overview",
position: "left",
label: "Documentation",
},
{
type: "doc",
- docId: "Api/DistGeneric",
+ docId: "Api/Dist",
position: "left",
label: "API",
},
@@ -84,6 +84,11 @@ const config = {
label: "GitHub",
position: "right",
},
+ {
+ href: "https://quantifieduncertainty.org/",
+ label: "QURI",
+ position: "right",
+ },
],
},
footer: {
diff --git a/packages/website/package.json b/packages/website/package.json
index 986b44c1..11e83791 100644
--- a/packages/website/package.json
+++ b/packages/website/package.json
@@ -15,7 +15,7 @@
"@docusaurus/core": "2.0.0-rc.1",
"@docusaurus/preset-classic": "2.0.0-rc.1",
"@heroicons/react": "^1.0.6",
- "@quri/squiggle-components": "^0.2.20",
+ "@quri/squiggle-components": "^0.2.23",
"base64-js": "^1.5.1",
"clsx": "^1.2.1",
"hast-util-is-element": "2.1.2",
diff --git a/packages/website/sidebars.js b/packages/website/sidebars.js
index a22b80a8..5c33d56c 100644
--- a/packages/website/sidebars.js
+++ b/packages/website/sidebars.js
@@ -23,8 +23,8 @@ const sidebars = {
tutorialSidebar: [
{
type: "doc",
- id: "Introduction",
- label: "Introduction",
+ id: "Overview",
+ label: "Overview",
},
{
type: "doc",
diff --git a/packages/website/src/components/SquiggleEditor.jsx b/packages/website/src/components/SquiggleEditor.jsx
index d8404b82..353fa0b2 100644
--- a/packages/website/src/components/SquiggleEditor.jsx
+++ b/packages/website/src/components/SquiggleEditor.jsx
@@ -12,3 +12,15 @@ export function SquiggleEditor(props) {
);
}
+
+export function SquiggleEditorWithImportedBindings(props) {
+ return (
+ }>
+ {() => {
+ const LibComponent =
+ require("@quri/squiggle-components").SquiggleEditorWithImportedBindings;
+ return ;
+ }}
+
+ );
+}
diff --git a/packages/website/src/css/custom.css b/packages/website/src/css/custom.css
index f5aa047d..7e4f5fe5 100644
--- a/packages/website/src/css/custom.css
+++ b/packages/website/src/css/custom.css
@@ -60,7 +60,7 @@ html[data-theme="dark"] .docusaurus-highlight-code-line {
}
.hero__subtitle2 {
- color: #ba3e3e;
+ color: #777;
font-size: 1.5em;
font-family: "Lora";
font-weight: 500;
@@ -88,6 +88,10 @@ h2 {
font-weight: 700;
}
+.navbar__logo {
+ height: 1.5rem;
+}
+
:root {
/* --ifm-font-family-base: 'Lora'; */
}
diff --git a/packages/website/src/pages/index.js b/packages/website/src/pages/index.js
index 05278aad..b0c26514 100644
--- a/packages/website/src/pages/index.js
+++ b/packages/website/src/pages/index.js
@@ -1,7 +1,6 @@
import React from "react";
import clsx from "clsx";
import Layout from "@theme/Layout";
-import Link from "@docusaurus/Link";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import styles from "./index.module.css";
import HomepageFeatures from "../components/HomepageFeatures";
@@ -11,6 +10,12 @@ function HomepageHeader() {
return (