squiggle/packages/website/docs/Guides/Language.mdx

55 lines
946 B
Plaintext
Raw Normal View History

2022-03-25 02:08:46 +00:00
---
sidebar_position: 1
2022-04-27 20:28:10 +00:00
title: Language Basics
2022-03-25 02:08:46 +00:00
---
2022-04-11 00:13:11 +00:00
import { SquiggleEditor } from "../../src/components/SquiggleEditor";
2022-03-25 02:08:46 +00:00
## Expressions
### Numbers
<SquiggleEditor defaultCode="4.32" />
### Distributions
2022-07-23 18:41:12 +00:00
<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])
2022-07-23 18:41:12 +00:00
{a:a, b:b, c:c, d:d}`}
/>
### Lists
2022-03-25 02:08:46 +00:00
2022-04-10 23:15:46 +00:00
<SquiggleEditor
defaultCode={`[beta(1,10), 4, isNormalized(SampleSet.fromDist(1 to 2))]`}
2022-04-10 23:15:46 +00:00
/>
2022-03-25 02:08:46 +00:00
2022-07-23 18:41:12 +00:00
<SquiggleEditor defaultCode={`List.make(5,1)`} />
### Dictionaries
2022-03-25 02:08:46 +00:00
<SquiggleEditor
defaultCode={`d = {dist: triangular(0, 1, 2), weight: 0.25}
d.dist`}
/>
2022-03-25 02:08:46 +00:00
### Functions
2022-03-25 02:08:46 +00:00
<SquiggleEditor
defaultCode={`f(t) = normal(t^2, t^1.2+.01)
f`}
/>
### Anonymous Functions
2022-03-25 02:08:46 +00:00
2022-07-23 18:41:12 +00:00
<SquiggleEditor defaultCode={`{|t| normal(t^2, t^1.2+.01)}`} />
## See more
2022-06-14 21:47:09 +00:00
- [Distribution creation](./DistributionCreation)
2022-05-20 15:50:53 +00:00
- [Functions reference](./Functions)
2022-05-20 15:46:10 +00:00
- [Gallery](../Discussions/Gallery)