v0.2.8: fromSamples
and jsImports
This commit is contained in:
parent
9464aea6fa
commit
9fe7034c51
|
@ -3,6 +3,21 @@
|
|||
|
||||
# Squiggle language
|
||||
|
||||
## Use the `npm` package
|
||||
|
||||
For instance, in a fresh `create-react-app`, you can
|
||||
|
||||
```sh
|
||||
yarn add @quri/squiggle-lang
|
||||
```
|
||||
|
||||
```js
|
||||
import {run} from '@quri/squiggle-lang';
|
||||
run("normal(0, 1) * fromSamples([-3,-2,-1,1,2,3,3,3,4,9]").value.value.toSparkline().value)
|
||||
```
|
||||
|
||||
**However, for most use cases you'll prefer to use our [library of react components](https://www.npmjs.com/package/@quri/squiggle-components)**, and let your app transitively depend on `@quri/squiggle-lang`.
|
||||
|
||||
## Build for development
|
||||
|
||||
We assume that you ran `yarn` at the monorepo level.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@quri/squiggle-lang",
|
||||
"version": "0.2.7",
|
||||
"version": "0.2.8",
|
||||
"homepage": "https://squiggle-language.com",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
|
@ -24,6 +24,7 @@
|
|||
"format:rescript": "rescript format -all",
|
||||
"format:prettier": "prettier --write .",
|
||||
"format": "yarn format:rescript && yarn format:prettier",
|
||||
"prepack": "yarn build && yarn test && yarn bundle",
|
||||
"all": "yarn build && yarn bundle && yarn test"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -35,7 +36,7 @@
|
|||
"rescript": "^9.1.4",
|
||||
"jstat": "^1.9.5",
|
||||
"pdfast": "^0.2.0",
|
||||
"mathjs": "10.5.0"
|
||||
"mathjs": "^10.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bisect_ppx": "^2.7.1",
|
||||
|
@ -61,6 +62,7 @@
|
|||
"webpack-cli": "^4.9.2"
|
||||
},
|
||||
"source": "./src/js/index.ts",
|
||||
"browser": "./dist/bundle.js",
|
||||
"main": "./dist/src/js/index.js",
|
||||
"types": "./dist/src/js/index.d.ts"
|
||||
}
|
||||
|
|
|
@ -189,7 +189,8 @@ let rec run = (~env, functionCallInfo: functionCallInfo): outputType => {
|
|||
->GenericDist.mixture(~scaleMultiplyFn=scaleMultiply, ~pointwiseAddFn=pointwiseAdd)
|
||||
->E.R2.fmap(r => Dist(r))
|
||||
->OutputLocal.fromResult
|
||||
| FromSamples(xs) => xs
|
||||
| FromSamples(xs) =>
|
||||
xs
|
||||
->SampleSetDist.make
|
||||
->E.R2.errMap(x => DistributionTypes.SampleSetError(x))
|
||||
->E.R2.fmap(x => x->DistributionTypes.SampleSet->Dist)
|
||||
|
|
Loading…
Reference in New Issue
Block a user