squiggle/packages/website/docs/Guides/Language.mdx
2022-07-23 11:06:15 -07:00

58 lines
949 B
Plaintext

---
sidebar_position: 1
title: Language Basics
---
import { SquiggleEditor } from "../../src/components/SquiggleEditor";
## Expressions
### Numbers
<SquiggleEditor defaultCode="4.32" />
### Distributions
<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}`} />
### Lists
<SquiggleEditor
defaultCode={`[beta(1,10), 4, isNormalized(SampleSet.fromDist(1 to 2))]`}
/>
<SquiggleEditor
defaultCode={`List.make(5,1)`}
/>
### Dictionaries
<SquiggleEditor
defaultCode={`d = {dist: triangular(0, 1, 2), weight: 0.25}
d.dist`}
/>
### Functions
<SquiggleEditor
defaultCode={`f(t) = normal(t^2, t^1.2+.01)
f`}
/>
### Anonymous Functions
<SquiggleEditor
defaultCode={`{|t| normal(t^2, t^1.2+.01)}`}
/>
## See more
- [Distribution creation](./DistributionCreation)
- [Functions reference](./Functions)
- [Gallery](../Discussions/Gallery)