Format on website
This commit is contained in:
parent
79b71c39a0
commit
afb69e2e06
|
@ -27,8 +27,8 @@ subtract: (date, duration) => date
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
makeFromYear(2040) - makeFromYear(2020) // 20 years
|
makeFromYear(2040) - makeFromYear(2020); // 20 years
|
||||||
makeFromYear(2040) - years(20) // 2020
|
makeFromYear(2040) - years(20); // 2020
|
||||||
```
|
```
|
||||||
|
|
||||||
### add
|
### add
|
||||||
|
|
|
@ -2,57 +2,70 @@
|
||||||
sidebar_position: 2
|
sidebar_position: 2
|
||||||
title: Dictionary
|
title: Dictionary
|
||||||
---
|
---
|
||||||
|
|
||||||
### toList
|
### toList
|
||||||
|
|
||||||
```
|
```
|
||||||
Dict.toList: (dict<'a>) => list<list<string|a>>
|
Dict.toList: (dict<'a>) => list<list<string|a>>
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
Dict.toList({foo: 3, bar: 20}) // [["foo", 3], ["bar", 20]]
|
Dict.toList({ foo: 3, bar: 20 }); // [["foo", 3], ["bar", 20]]
|
||||||
```
|
```
|
||||||
|
|
||||||
### fromList
|
### fromList
|
||||||
|
|
||||||
```
|
```
|
||||||
Dict.fromList: (list<list<string|'a>>) => dict<'a>
|
Dict.fromList: (list<list<string|'a>>) => dict<'a>
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
Dict.fromList([["foo", 3], ["bar", 20]]) // {foo: 3, bar: 20}
|
Dict.fromList([
|
||||||
|
["foo", 3],
|
||||||
|
["bar", 20],
|
||||||
|
]); // {foo: 3, bar: 20}
|
||||||
```
|
```
|
||||||
|
|
||||||
### keys
|
### keys
|
||||||
|
|
||||||
```
|
```
|
||||||
Dict.keys: (dict<'a>) => list<string>
|
Dict.keys: (dict<'a>) => list<string>
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
Dict.keys({foo: 3, bar: 20}) // ["foo", "bar"]
|
Dict.keys({ foo: 3, bar: 20 }); // ["foo", "bar"]
|
||||||
```
|
```
|
||||||
|
|
||||||
### values
|
### values
|
||||||
|
|
||||||
```
|
```
|
||||||
Dict.values: (dict<'a>) => list<'a>
|
Dict.values: (dict<'a>) => list<'a>
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
Dict.values({foo: 3, bar: 20}) // [3, 20]
|
Dict.values({ foo: 3, bar: 20 }); // [3, 20]
|
||||||
```
|
```
|
||||||
|
|
||||||
### merge
|
### merge
|
||||||
|
|
||||||
```
|
```
|
||||||
Dict.merge: (dict<'a>, dict<'b>) => dict<'a|b>
|
Dict.merge: (dict<'a>, dict<'b>) => dict<'a|b>
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
first = {a: 1, b: 2}
|
first = { a: 1, b: 2 };
|
||||||
snd = {b: 3, c: 5}
|
snd = { b: 3, c: 5 };
|
||||||
Dict.merge(first, snd) // {a: 1, b: 3, c: 5}
|
Dict.merge(first, snd); // {a: 1, b: 3, c: 5}
|
||||||
```
|
```
|
||||||
|
|
||||||
### mergeMany
|
### mergeMany
|
||||||
|
|
||||||
```
|
```
|
||||||
Dict.mergeMany: (list<dict<'a>>) => dict<'a>
|
Dict.mergeMany: (list<dict<'a>>) => dict<'a>
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
first = {a: 1, b: 2}
|
first = { a: 1, b: 2 };
|
||||||
snd = {b: 3, c: 5}
|
snd = { b: 3, c: 5 };
|
||||||
Dict.mergeMany([first, snd]) // {a: 1, b: 3, c: 5}
|
Dict.mergeMany([first, snd]); // {a: 1, b: 3, c: 5}
|
||||||
```
|
```
|
||||||
|
|
|
@ -257,7 +257,7 @@ sampleN: (distribution, number) => list<number>
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
sample: (normal(5, 2), 100);
|
sample: normal(5, 2), 100;
|
||||||
```
|
```
|
||||||
|
|
||||||
### mean
|
### mean
|
||||||
|
@ -265,49 +265,49 @@ sample: (normal(5, 2), 100);
|
||||||
Get the distribution mean
|
Get the distribution mean
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
mean: (distribution) => number
|
mean: (distribution) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
mean: (normal(5, 2));
|
mean: normal(5, 2);
|
||||||
```
|
```
|
||||||
|
|
||||||
### stdev
|
### stdev
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
stdev: (distribution) => number
|
stdev: (distribution) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
### variance
|
### variance
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
variance: (distribution) => number
|
variance: (distribution) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
### mode
|
### mode
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
mode: (distribution) => number
|
mode: (distribution) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
### cdf
|
### cdf
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
cdf: (distribution, number) => number
|
cdf: (distribution, number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
cdf: (normal(5, 2), 3);
|
cdf: normal(5, 2), 3;
|
||||||
```
|
```
|
||||||
|
|
||||||
### pdf
|
### pdf
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
pdf: (distribution, number) => number
|
pdf: (distribution, number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
@ -319,7 +319,7 @@ pdf(normal(5, 2), 3);
|
||||||
### inv
|
### inv
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
inv: (distribution, number) => number
|
inv: (distribution, number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
@ -333,7 +333,7 @@ inv(normal(5, 2), 0.5);
|
||||||
Converts a distribution to the pointSet format
|
Converts a distribution to the pointSet format
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
toPointSet: (distribution) => pointSetDistribution
|
toPointSet: (distribution) => pointSetDistribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
@ -347,7 +347,7 @@ toPointSet(normal(5, 2));
|
||||||
Converts a distribution to the sampleSet format, with n samples
|
Converts a distribution to the sampleSet format, with n samples
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
toSampleSet: (distribution,number) => sampleSetDistribution
|
toSampleSet: (distribution, number) => sampleSetDistribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
@ -391,7 +391,7 @@ truncateLeft(normal(5, 2), 6);
|
||||||
Kullback–Leibler divergence between two distributions
|
Kullback–Leibler divergence between two distributions
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
klDivergence: (distribution, distribution) => number
|
klDivergence: (distribution, distribution) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
@ -405,7 +405,7 @@ klDivergence(normal(5, 2), normal(5, 4)); // returns 0.57
|
||||||
### toString
|
### toString
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
toString: (distribution) => string
|
toString: (distribution) => string;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
@ -419,7 +419,7 @@ toString(normal(5, 2));
|
||||||
Produce a sparkline of length n
|
Produce a sparkline of length n
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
toSparkline: (distribution, n=20) => string
|
toSparkline: (distribution, n = 20) => string;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
@ -433,7 +433,7 @@ toSparkline(normal(5, 2), 10);
|
||||||
Prints the value of the distribution to the Javascript console, then returns the distribution.
|
Prints the value of the distribution to the Javascript console, then returns the distribution.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
inspect: (distribution) => distribution
|
inspect: (distribution) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
@ -449,7 +449,7 @@ inspect(normal(5, 2));
|
||||||
Normalize a distribution. This means scaling it appropriately so that it's cumulative sum is equal to 1.
|
Normalize a distribution. This means scaling it appropriately so that it's cumulative sum is equal to 1.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
normalize: (distribution) => distribution
|
normalize: (distribution) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
@ -463,7 +463,7 @@ normalize(normal(5, 2));
|
||||||
Check of a distribution is normalized. Most distributions are typically normalized, but there are some commands that could produce non-normalized distributions.
|
Check of a distribution is normalized. Most distributions are typically normalized, but there are some commands that could produce non-normalized distributions.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
isNormalized: (distribution) => bool
|
isNormalized: (distribution) => bool;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
@ -477,7 +477,7 @@ isNormalized(normal(5, 2)); // returns true
|
||||||
Get the sum of the integral of a distribution. If the distribution is normalized, this will be 1.
|
Get the sum of the integral of a distribution. If the distribution is normalized, this will be 1.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
integralSum: (distribution) => number
|
integralSum: (distribution) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
@ -491,7 +491,7 @@ integralSum(normal(5, 2));
|
||||||
### add
|
### add
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
add: (distributionLike, distributionLike) => distribution
|
add: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### sum
|
### sum
|
||||||
|
@ -503,7 +503,7 @@ sum: (list<distributionLike>) => distribution
|
||||||
### multiply
|
### multiply
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
multiply: (distributionLike, distributionLike) => distribution
|
multiply: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### product
|
### product
|
||||||
|
@ -515,43 +515,43 @@ product: (list<distributionLike>) => distribution
|
||||||
### subtract
|
### subtract
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
subtract: (distributionLike, distributionLike) => distribution
|
subtract: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### divide
|
### divide
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
divide: (distributionLike, distributionLike) => distribution
|
divide: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### pow
|
### pow
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
pow: (distributionLike, distributionLike) => distribution
|
pow: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### exp
|
### exp
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
exp: (distributionLike, distributionLike) => distribution
|
exp: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### log
|
### log
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
log: (distributionLike, distributionLike) => distribution
|
log: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### log10
|
### log10
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
log10: (distributionLike, distributionLike) => distribution
|
log10: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### unaryMinus
|
### unaryMinus
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
unaryMinus: (distribution) => distribution
|
unaryMinus: (distribution) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Pointwise Operations
|
## Pointwise Operations
|
||||||
|
@ -559,37 +559,37 @@ unaryMinus: (distribution) => distribution
|
||||||
### dotAdd
|
### dotAdd
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
dotAdd: (distributionLike, distributionLike) => distribution
|
dotAdd: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### dotMultiply
|
### dotMultiply
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
dotMultiply: (distributionLike, distributionLike) => distribution
|
dotMultiply: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### dotSubtract
|
### dotSubtract
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
dotSubtract: (distributionLike, distributionLike) => distribution
|
dotSubtract: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### dotDivide
|
### dotDivide
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
dotDivide: (distributionLike, distributionLike) => distribution
|
dotDivide: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### dotPow
|
### dotPow
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
dotPow: (distributionLike, distributionLike) => distribution
|
dotPow: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### dotExp
|
### dotExp
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
dotExp: (distributionLike, distributionLike) => distribution
|
dotExp: (distributionLike, distributionLike) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Scale Operations
|
## Scale Operations
|
||||||
|
@ -597,31 +597,31 @@ dotExp: (distributionLike, distributionLike) => distribution
|
||||||
### scaleMultiply
|
### scaleMultiply
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
scaleMultiply: (distributionLike, number) => distribution
|
scaleMultiply: (distributionLike, number) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### scalePow
|
### scalePow
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
scalePow: (distributionLike, number) => distribution
|
scalePow: (distributionLike, number) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### scaleExp
|
### scaleExp
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
scaleExp: (distributionLike, number) => distribution
|
scaleExp: (distributionLike, number) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### scaleLog
|
### scaleLog
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
scaleLog: (distributionLike, number) => distribution
|
scaleLog: (distributionLike, number) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
### scaleLog10
|
### scaleLog10
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
scaleLog10: (distributionLike, number) => distribution
|
scaleLog10: (distributionLike, number) => distribution;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Special
|
## Special
|
||||||
|
|
|
@ -4,16 +4,19 @@ title: Point Set Distribution
|
||||||
---
|
---
|
||||||
|
|
||||||
### make
|
### make
|
||||||
|
|
||||||
```
|
```
|
||||||
PointSet.make: (distribution) => pointSetDist
|
PointSet.make: (distribution) => pointSetDist
|
||||||
```
|
```
|
||||||
|
|
||||||
### makeContinuous
|
### makeContinuous
|
||||||
|
|
||||||
```
|
```
|
||||||
PointSet.makeContinuous: (list<{x: number, y: number}>) => pointSetDist
|
PointSet.makeContinuous: (list<{x: number, y: number}>) => pointSetDist
|
||||||
```
|
```
|
||||||
|
|
||||||
### makeDiscrete
|
### makeDiscrete
|
||||||
|
|
||||||
```
|
```
|
||||||
PointSet.makeDiscrete: (list<{x: number, y: number}>) => pointSetDist
|
PointSet.makeDiscrete: (list<{x: number, y: number}>) => pointSetDist
|
||||||
```
|
```
|
||||||
|
|
|
@ -4,6 +4,7 @@ title: Sample Set Distribution
|
||||||
---
|
---
|
||||||
|
|
||||||
### make
|
### make
|
||||||
|
|
||||||
```
|
```
|
||||||
SampleSet.make: (distribution) => sampleSet
|
SampleSet.make: (distribution) => sampleSet
|
||||||
SampleSet.make: (() => number) => sampleSet
|
SampleSet.make: (() => number) => sampleSet
|
||||||
|
@ -11,30 +12,33 @@ SampleSet.make: (list<number>) => sampleSet
|
||||||
```
|
```
|
||||||
|
|
||||||
### map
|
### map
|
||||||
|
|
||||||
```
|
```
|
||||||
SampleSet.map: (sampleSet, (number => number)) => sampleSet
|
SampleSet.map: (sampleSet, (number => number)) => sampleSet
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### map2
|
### map2
|
||||||
|
|
||||||
```
|
```
|
||||||
SampleSet.map2: (sampleSet, sampleSet, ((number, number) => number)) => sampleSet
|
SampleSet.map2: (sampleSet, sampleSet, ((number, number) => number)) => sampleSet
|
||||||
```
|
```
|
||||||
|
|
||||||
### map3
|
### map3
|
||||||
|
|
||||||
```
|
```
|
||||||
SampleSet.map3: (sampleSet, sampleSet, sampleSet, ((number, number, number) => number)) => sampleSet
|
SampleSet.map3: (sampleSet, sampleSet, sampleSet, ((number, number, number) => number)) => sampleSet
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### toList
|
### toList
|
||||||
|
|
||||||
```
|
```
|
||||||
SampleSet.toList: (sampleSet) => list<number>
|
SampleSet.toList: (sampleSet) => list<number>
|
||||||
```
|
```
|
||||||
|
|
||||||
Gets the internal samples of a sampleSet distribution. This is separate from the sampleN() function, which would shuffle the samples. toList() maintains order and length. Gets the internal samples of a sampleSet distribution. This is separate from the sampleN() function, which would shuffle the samples. toList() maintains order and length.
|
Gets the internal samples of a sampleSet distribution. This is separate from the sampleN() function, which would shuffle the samples. toList() maintains order and length. Gets the internal samples of a sampleSet distribution. This is separate from the sampleN() function, which would shuffle the samples. toList() maintains order and length.
|
||||||
|
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
```
|
```
|
||||||
toList(toSampleSet(normal(5,2)))
|
toList(toSampleSet(normal(5,2)))
|
||||||
```
|
```
|
||||||
|
|
|
@ -8,6 +8,7 @@ import TOCInline from "@theme/TOCInline";
|
||||||
<TOCInline toc={toc} />
|
<TOCInline toc={toc} />
|
||||||
|
|
||||||
### toString
|
### toString
|
||||||
|
|
||||||
```
|
```
|
||||||
toString: (duration) => string
|
toString: (duration) => string
|
||||||
```
|
```
|
||||||
|
@ -15,41 +16,49 @@ toString: (duration) => string
|
||||||
## Units
|
## Units
|
||||||
|
|
||||||
### minutes
|
### minutes
|
||||||
|
|
||||||
```
|
```
|
||||||
minutes: (number) => duration
|
minutes: (number) => duration
|
||||||
```
|
```
|
||||||
|
|
||||||
### hours
|
### hours
|
||||||
|
|
||||||
```
|
```
|
||||||
hours: (number) => duration
|
hours: (number) => duration
|
||||||
```
|
```
|
||||||
|
|
||||||
### days
|
### days
|
||||||
|
|
||||||
```
|
```
|
||||||
days: (number) => duration
|
days: (number) => duration
|
||||||
```
|
```
|
||||||
|
|
||||||
### years
|
### years
|
||||||
|
|
||||||
```
|
```
|
||||||
years: (number) => duration
|
years: (number) => duration
|
||||||
```
|
```
|
||||||
|
|
||||||
### toHours
|
### toHours
|
||||||
|
|
||||||
```
|
```
|
||||||
toHours: (duration) => number
|
toHours: (duration) => number
|
||||||
```
|
```
|
||||||
|
|
||||||
### toMinutes
|
### toMinutes
|
||||||
|
|
||||||
```
|
```
|
||||||
toMinutes: (duration) => number
|
toMinutes: (duration) => number
|
||||||
```
|
```
|
||||||
|
|
||||||
### toDays
|
### toDays
|
||||||
|
|
||||||
```
|
```
|
||||||
toDays: (duration) => number
|
toDays: (duration) => number
|
||||||
```
|
```
|
||||||
|
|
||||||
### toYears
|
### toYears
|
||||||
|
|
||||||
```
|
```
|
||||||
toYears: (duration) => number
|
toYears: (duration) => number
|
||||||
```
|
```
|
||||||
|
@ -57,21 +66,25 @@ toYears: (duration) => number
|
||||||
## Algebra
|
## Algebra
|
||||||
|
|
||||||
### add
|
### add
|
||||||
|
|
||||||
```
|
```
|
||||||
add: (duration, duration) => duration
|
add: (duration, duration) => duration
|
||||||
```
|
```
|
||||||
|
|
||||||
### subtract
|
### subtract
|
||||||
|
|
||||||
```
|
```
|
||||||
subtract: (duration, duration) => duration
|
subtract: (duration, duration) => duration
|
||||||
```
|
```
|
||||||
|
|
||||||
### multiply
|
### multiply
|
||||||
|
|
||||||
```
|
```
|
||||||
multiply: (duration, number) => duration
|
multiply: (duration, number) => duration
|
||||||
```
|
```
|
||||||
|
|
||||||
### divide
|
### divide
|
||||||
|
|
||||||
```
|
```
|
||||||
divide: (duration, number) => duration
|
divide: (duration, number) => duration
|
||||||
```
|
```
|
||||||
|
|
|
@ -4,53 +4,63 @@ title: List
|
||||||
---
|
---
|
||||||
|
|
||||||
### make
|
### make
|
||||||
|
|
||||||
```
|
```
|
||||||
List.make: (number, 'a) => list<'a>
|
List.make: (number, 'a) => list<'a>
|
||||||
```
|
```
|
||||||
Returns an array of size ``n`` filled with value ``e``.
|
|
||||||
|
Returns an array of size `n` filled with value `e`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
List.make(4, 1) // creates the list [1, 1, 1, 1]
|
List.make(4, 1); // creates the list [1, 1, 1, 1]
|
||||||
```
|
```
|
||||||
|
|
||||||
See [Rescript implementation](https://rescript-lang.org/docs/manual/latest/api/belt/array#make)
|
See [Rescript implementation](https://rescript-lang.org/docs/manual/latest/api/belt/array#make)
|
||||||
|
|
||||||
### toString
|
### toString
|
||||||
|
|
||||||
```
|
```
|
||||||
toString: (list<'a>) => string
|
toString: (list<'a>) => string
|
||||||
```
|
```
|
||||||
|
|
||||||
### length
|
### length
|
||||||
|
|
||||||
```
|
```
|
||||||
length: (list<'a>) => number
|
length: (list<'a>) => number
|
||||||
```
|
```
|
||||||
|
|
||||||
### up to
|
### up to
|
||||||
|
|
||||||
```
|
```
|
||||||
List.upTo: (low:number, high:number) => list<number>
|
List.upTo: (low:number, high:number) => list<number>
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
List.upTo(0, 5) // creates the list [0, 1, 2, 3, 4, 5]
|
List.upTo(0, 5); // creates the list [0, 1, 2, 3, 4, 5]
|
||||||
```
|
```
|
||||||
|
|
||||||
Syntax taken from [Ruby](https://apidock.com/ruby/v2_5_5/Integer/upto).
|
Syntax taken from [Ruby](https://apidock.com/ruby/v2_5_5/Integer/upto).
|
||||||
|
|
||||||
### first
|
### first
|
||||||
|
|
||||||
```
|
```
|
||||||
first: (list<'a>) => 'a
|
first: (list<'a>) => 'a
|
||||||
```
|
```
|
||||||
|
|
||||||
### last
|
### last
|
||||||
|
|
||||||
```
|
```
|
||||||
last: (list<'a>) => 'a
|
last: (list<'a>) => 'a
|
||||||
```
|
```
|
||||||
|
|
||||||
### reverse
|
### reverse
|
||||||
|
|
||||||
```
|
```
|
||||||
reverse: (list<'a>) => list<'a>
|
reverse: (list<'a>) => list<'a>
|
||||||
```
|
```
|
||||||
|
|
||||||
### map
|
### map
|
||||||
|
|
||||||
```
|
```
|
||||||
map: (list<'a>, a => b) => list<'b>
|
map: (list<'a>, a => b) => list<'b>
|
||||||
```
|
```
|
||||||
|
@ -58,12 +68,14 @@ map: (list<'a>, a => b) => list<'b>
|
||||||
See [Rescript implementation](https://rescript-lang.org/docs/manual/latest/api/belt/array#map).
|
See [Rescript implementation](https://rescript-lang.org/docs/manual/latest/api/belt/array#map).
|
||||||
|
|
||||||
### reduce
|
### reduce
|
||||||
```
|
|
||||||
reduce: (list<'b>, 'a, ('a, 'b) => 'a) => 'a
|
|
||||||
```
|
|
||||||
``reduce(arr, init, f)``
|
|
||||||
|
|
||||||
Applies ``f`` to each element of ``arr``. The function ``f`` has two paramaters, an accumulator and the next value from the array.
|
```
|
||||||
|
reduce: (list<'b>, 'a, ('a, 'b) => 'a) => 'a
|
||||||
|
```
|
||||||
|
|
||||||
|
`reduce(arr, init, f)`
|
||||||
|
|
||||||
|
Applies `f` to each element of `arr`. The function `f` has two paramaters, an accumulator and the next value from the array.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
reduce([2, 3, 4], 1, {|acc, value| acc + value}) == 10
|
reduce([2, 3, 4], 1, {|acc, value| acc + value}) == 10
|
||||||
|
@ -72,10 +84,11 @@ reduce([2, 3, 4], 1, {|acc, value| acc + value}) == 10
|
||||||
See [Rescript implementation](https://rescript-lang.org/docs/manual/latest/api/belt/array#reduce).
|
See [Rescript implementation](https://rescript-lang.org/docs/manual/latest/api/belt/array#reduce).
|
||||||
|
|
||||||
### reduce reverse
|
### reduce reverse
|
||||||
|
|
||||||
```
|
```
|
||||||
reduceReverse: (list<'b>, 'a, ('a, 'b) => 'a) => 'a
|
reduceReverse: (list<'b>, 'a, ('a, 'b) => 'a) => 'a
|
||||||
```
|
```
|
||||||
|
|
||||||
Works like ``reduce``, but the function is applied to each item from the last back to the first.
|
Works like `reduce`, but the function is applied to each item from the last back to the first.
|
||||||
|
|
||||||
See [Rescript implementation](https://rescript-lang.org/docs/manual/latest/api/belt/array#reducereverse).
|
See [Rescript implementation](https://rescript-lang.org/docs/manual/latest/api/belt/array#reducereverse).
|
||||||
|
|
|
@ -4,61 +4,81 @@ title: Math
|
||||||
---
|
---
|
||||||
|
|
||||||
### E
|
### E
|
||||||
|
|
||||||
```
|
```
|
||||||
Math.E:
|
Math.E:
|
||||||
```
|
```
|
||||||
|
|
||||||
Euler's number; ≈ 2.718281828459045
|
Euler's number; ≈ 2.718281828459045
|
||||||
|
|
||||||
### LN2
|
### LN2
|
||||||
|
|
||||||
```
|
```
|
||||||
Math.LN2:
|
Math.LN2:
|
||||||
```
|
```
|
||||||
|
|
||||||
Natural logarithm of 2; ≈ 0.6931471805599453
|
Natural logarithm of 2; ≈ 0.6931471805599453
|
||||||
|
|
||||||
### LN10
|
### LN10
|
||||||
|
|
||||||
```
|
```
|
||||||
Math.LN10:
|
Math.LN10:
|
||||||
```
|
```
|
||||||
|
|
||||||
Natural logarithm of 10; ≈ 2.302585092994046
|
Natural logarithm of 10; ≈ 2.302585092994046
|
||||||
|
|
||||||
### LOG2E
|
### LOG2E
|
||||||
|
|
||||||
```
|
```
|
||||||
Math.LOG2E:
|
Math.LOG2E:
|
||||||
```
|
```
|
||||||
|
|
||||||
Base 2 logarithm of E; ≈ 1.4426950408889634Base 2 logarithm of E; ≈ 1.4426950408889634
|
Base 2 logarithm of E; ≈ 1.4426950408889634Base 2 logarithm of E; ≈ 1.4426950408889634
|
||||||
|
|
||||||
### LOG10E
|
### LOG10E
|
||||||
|
|
||||||
```
|
```
|
||||||
Math.LOG10E:
|
Math.LOG10E:
|
||||||
```
|
```
|
||||||
|
|
||||||
Base 10 logarithm of E; ≈ 0.4342944819032518
|
Base 10 logarithm of E; ≈ 0.4342944819032518
|
||||||
|
|
||||||
### PI
|
### PI
|
||||||
|
|
||||||
```
|
```
|
||||||
Math.PI:
|
Math.PI:
|
||||||
```
|
```
|
||||||
|
|
||||||
Pi - ratio of the circumference to the diameter of a circle; ≈ 3.141592653589793
|
Pi - ratio of the circumference to the diameter of a circle; ≈ 3.141592653589793
|
||||||
|
|
||||||
### SQRT1_2
|
### SQRT1_2
|
||||||
|
|
||||||
```
|
```
|
||||||
Math.SQRT1_2:
|
Math.SQRT1_2:
|
||||||
```
|
```
|
||||||
|
|
||||||
Square root of 1/2; ≈ 0.7071067811865476
|
Square root of 1/2; ≈ 0.7071067811865476
|
||||||
|
|
||||||
### SQRT2
|
### SQRT2
|
||||||
|
|
||||||
```
|
```
|
||||||
Math.SQRT2:
|
Math.SQRT2:
|
||||||
```
|
```
|
||||||
|
|
||||||
Square root of 2; ≈ 1.4142135623730951
|
Square root of 2; ≈ 1.4142135623730951
|
||||||
|
|
||||||
### PHI
|
### PHI
|
||||||
|
|
||||||
```
|
```
|
||||||
Math.PHI:
|
Math.PHI:
|
||||||
```
|
```
|
||||||
|
|
||||||
Phi is the golden ratio. 1.618033988749895
|
Phi is the golden ratio. 1.618033988749895
|
||||||
|
|
||||||
### TAU
|
### TAU
|
||||||
|
|
||||||
```
|
```
|
||||||
Math.TAU:
|
Math.TAU:
|
||||||
```
|
```
|
||||||
Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi. 6.283185307179586
|
|
||||||
|
Tau is the ratio constant of a circle's circumference to radius, equal to 2 \* pi. 6.283185307179586
|
||||||
|
|
|
@ -10,25 +10,25 @@ import TOCInline from "@theme/TOCInline";
|
||||||
### ceil
|
### ceil
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
ceil: (number) => number
|
ceil: (number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
### floor
|
### floor
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
floor: (number) => number
|
floor: (number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
### abs
|
### abs
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
abs: (number) => number
|
abs: (number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
### round
|
### round
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
round: (number) => number
|
round: (number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Statistics
|
## Statistics
|
||||||
|
@ -68,19 +68,19 @@ variance: (list<number>) => number
|
||||||
### unaryMinus
|
### unaryMinus
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
unaryMinus: (number) => number
|
unaryMinus: (number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
### equal
|
### equal
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
equal: (number, number) => boolean
|
equal: (number, number) => boolean;
|
||||||
```
|
```
|
||||||
|
|
||||||
### add
|
### add
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
add: (number, number) => number
|
add: (number, number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
### sum
|
### sum
|
||||||
|
@ -98,7 +98,7 @@ cumsum: (list<number>) => list<number>
|
||||||
### multiply
|
### multiply
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
multiply: (number, number) => number
|
multiply: (number, number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
### product
|
### product
|
||||||
|
@ -116,29 +116,29 @@ cumprod: (list<number>) => list<number>
|
||||||
### subtract
|
### subtract
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
subtract: (number, number) => number
|
subtract: (number, number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
### divide
|
### divide
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
divide: (number, number) => number
|
divide: (number, number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
### pow
|
### pow
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
pow: (number, number) => number
|
pow: (number, number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
### exp
|
### exp
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
exp: (number) => number
|
exp: (number) => number;
|
||||||
```
|
```
|
||||||
|
|
||||||
### log
|
### log
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
log: (number) => number
|
log: (number) => number;
|
||||||
```
|
```
|
||||||
|
|
|
@ -16,8 +16,8 @@ const sidebars = {
|
||||||
// By default, Docusaurus generates a sidebar from the docs folder structure
|
// By default, Docusaurus generates a sidebar from the docs folder structure
|
||||||
apiSidebar: [
|
apiSidebar: [
|
||||||
{
|
{
|
||||||
type: 'autogenerated',
|
type: "autogenerated",
|
||||||
dirName: 'Api',
|
dirName: "Api",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
tutorialSidebar: [
|
tutorialSidebar: [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user