Modifiying Overview page and Guides

This commit is contained in:
Ozzie Gooen 2022-07-27 21:08:10 -07:00
parent b1cc459d13
commit 327dc521f1
6 changed files with 59 additions and 22 deletions

View File

@ -1,5 +1,5 @@
---
title: "Distribution Creation"
title: "Distributions: Creation"
sidebar_position: 2
---

View File

@ -1,5 +1,5 @@
---
title: "Distribution Functions"
title: "Distributions: Key Functions"
sidebar_position: 3
---

View File

@ -5,63 +5,93 @@ title: Language Basics
import { SquiggleEditor } from "../../src/components/SquiggleEditor";
## Expressions
Squiggle supports some simple types and language features.
### Numbers
## Numbers
<SquiggleEditor defaultCode="4.32" />
### Distributions
## Distributions
There are several ways of easily entering distributions. See the [documentation](/docs/Api/Dist/) on distributions for a complete API.
<SquiggleEditor
defaultCode={`a = normal(4,2)
b = 30 to 50
c = lognormal({mean:90, stdev: 7})
d = mixture(a,b,c, [0.3, 0.3, .4])
{a:a, b:b, c:c, d:d}`}
d = mixture(a,b,c, [.3, .3, .4])
d`}
/>
### Lists
## Lists
Squiggle lists can accept items of any type, similar to those in Python. [API](/docs/Api/List).
<SquiggleEditor
defaultCode={`[beta(1,10), 4, isNormalized(SampleSet.fromDist(1 to 2))]`}
/>
<SquiggleEditor defaultCode={`List.make(5,1)`} />
### Dictionaries
## Dictionaries
Squiggle dictionaries work similarly to Python dictionaries. [API](/docs/Api/Dictionary).
<SquiggleEditor
defaultCode={`d = {dist: triangular(0, 1, 2), weight: 0.25}
d.dist`}
/>
### Functions
## Functions
<SquiggleEditor
defaultCode={`f(t) = normal(t^2, t^1.2+.01)
f`}
/>
### Anonymous Functions
## Anonymous Functions
<SquiggleEditor defaultCode={`{|t| normal(t^2, t^1.2+.01)}`} />
### Comments
## Comments
<SquiggleEditor defaultCode={`// This is a single-line comment
<SquiggleEditor defaultCode={`// This is a single-line comment\n
/*
This is a multiple
-line comment.
*/
""
`} />
### Pipes
## Pipes
<SquiggleEditor defaultCode={`normal(5,2) |> truncateLeft(3) |> SampleSet.fromDist`} />
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.
<SquiggleEditor defaultCode={`normal(5,2) |> truncateLeft(3) |> SampleSet.fromDist |> SampleSet.map({|r| r + 10})`} />
## See more
## Standard Library
- [Distribution creation](./DistributionCreation)
- [Functions reference](./Functions)
- [Gallery](../Discussions/Gallery)
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,
<SquiggleEditor defaultCode={`a = List.upTo(0, 5000) |> 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 |
<SquiggleEditor defaultCode={`simpleNumber = 4.32k
distribution = 40M to 50M
distribution`} />
## Gotchas and Key Limitations
****

View File

@ -22,6 +22,13 @@ All of the components used in the playground and documentation are available in
**[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.
## Very simple model
```squiggle
//Write comments like this
/*
```
## Squiggle Vs. Other Tools
### What Squiggle Is

View File

@ -68,7 +68,7 @@ const config = {
},
{
type: "doc",
docId: "Api/DistGeneric",
docId: "Api/Dist",
position: "left",
label: "API",
},