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

40 lines
933 B
Plaintext
Raw Normal View History

2022-03-25 02:08:46 +00:00
---
sidebar_position: 2
---
2022-04-11 00:13:11 +00:00
import { SquiggleEditor } from "../../src/components/SquiggleEditor";
2022-03-25 02:08:46 +00:00
# Squiggle Language
The squiggle language has a very simple syntax. The best way to get to understand
2022-03-25 02:08:46 +00:00
it is by simply looking at examples.
2022-04-10 23:15:46 +00:00
## Basic Language
2022-03-25 02:08:46 +00:00
As an example:
2022-04-10 23:15:46 +00:00
<SquiggleEditor
initialSquiggleString={`value_of_work = 10 to 70
value_of_work`}
/>
2022-03-25 02:08:46 +00:00
Squiggle can declare variables (`value_of_work = 10 to 70`) and declare exports
(the lone `value_of_work` line). Variables can be used later in a squiggle program
2022-04-10 23:15:46 +00:00
and even in other notebooks!
2022-03-25 02:08:46 +00:00
An export is rendered to the output view so you can see your result.
the exports can be expressions, such as:
<SquiggleEditor initialSquiggleString="normal(0,1)" />
## Functions
Squiggle supports functions, including the rendering of functions:
2022-04-10 23:15:46 +00:00
<SquiggleEditor
initialSquiggleString={`ozzie_estimate(t) = lognormal({mean: 3 + (t+.1)^2.5, stdev: 8})
2022-03-25 02:08:46 +00:00
ozzie_estimate
2022-04-10 23:15:46 +00:00
`}
/>