68 lines
1.1 KiB
Plaintext
68 lines
1.1 KiB
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)}`} />
|
|
|
|
### Comments
|
|
|
|
<SquiggleEditor defaultCode={`// This is a single-line comment
|
|
/*
|
|
This is a multiple
|
|
-line comment.
|
|
*/
|
|
`} />
|
|
|
|
### Pipes
|
|
|
|
<SquiggleEditor defaultCode={`normal(5,2) |> truncateLeft(3) |> SampleSet.fromDist`} />
|
|
|
|
## See more
|
|
|
|
- [Distribution creation](./DistributionCreation)
|
|
- [Functions reference](./Functions)
|
|
- [Gallery](../Discussions/Gallery)
|