Attempting to make all api docs formatting mostly consistent

This commit is contained in:
Ozzie Gooen 2022-06-11 08:28:38 -07:00
parent 6dc8b711bb
commit 2d4d8a8f4d
5 changed files with 58 additions and 42 deletions

View File

@ -32,7 +32,7 @@ Dict.keys({foo: 3, bar: 20}) // ["foo", "bar"]
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

View File

@ -222,7 +222,7 @@ toDiscretePointSet([
### mixture ### mixture
```javascript ```javascript
mixture: (...distributionLike, weights:list<float>):distribution mixture: (...distributionLike, weights:list<float>) => distribution
``` ```
**Examples** **Examples**
@ -237,7 +237,7 @@ mx(normal(5, 1), normal(10, 1), [0.3, 0.7]);
Get one random sample from the distribution Get one random sample from the distribution
```javascript ```javascript
sample(distribution):number sample(distribution) => number
``` ```
**Examples** **Examples**
@ -265,7 +265,7 @@ sample: (normal(5, 2), 100);
Get the distribution mean Get the distribution mean
```javascript ```javascript
mean: (distribution):number mean: (distribution) => number
``` ```
**Examples** **Examples**
@ -277,25 +277,25 @@ 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**
@ -307,7 +307,7 @@ 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**
@ -361,7 +361,7 @@ toSampleSet(normal(5, 2), 1000);
Truncates the left side of a distribution. Returns either a pointSet distribution or a symbolic distribution. Truncates the left side of a distribution. Returns either a pointSet distribution or a symbolic distribution.
```javascript ```javascript
truncateLeft: (distribution, l:number):distribution truncateLeft: (distribution, l => number) => distribution
``` ```
**Examples** **Examples**
@ -375,7 +375,7 @@ truncateLeft(normal(5, 2), 3);
Truncates the right side of a distribution. Returns either a pointSet distribution or a symbolic distribution. Truncates the right side of a distribution. Returns either a pointSet distribution or a symbolic distribution.
```javascript ```javascript
truncateRight: (distribution, r:number):distribution truncateRight: (distribution, r => number) => distribution
``` ```
**Examples** **Examples**
@ -391,7 +391,7 @@ truncateLeft(normal(5, 2), 6);
KullbackLeibler divergence between two distributions KullbackLeibler 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
: (distribution):string : (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**
@ -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,67 +491,67 @@ integralSum(normal(5, 2));
### add ### add
```javascript ```javascript
add: (distributionLike, distributionLike): distribution add: (distributionLike, distributionLike) => distribution
``` ```
### sum ### sum
```javascript ```javascript
sum: (list<distributionLike>): distribution sum: (list<distributionLike>) => distribution
``` ```
### multiply ### multiply
```javascript ```javascript
multiply: (distributionLike, distributionLike): distribution multiply: (distributionLike, distributionLike) => distribution
``` ```
### product ### product
```javascript ```javascript
product: (list<distributionLike>): distribution 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

View File

@ -3,11 +3,17 @@ sidebar_position: 6
title: Duration title: Duration
--- ---
import TOCInline from "@theme/TOCInline";
<TOCInline toc={toc} />
### toString ### toString
``` ```
toString: (duration) => string toString: (duration) => string
``` ```
## Units
### minutes ### minutes
``` ```
minutes: (number) => duration minutes: (number) => duration
@ -48,6 +54,8 @@ toDays: (duration) => number
toYears: (duration) => number toYears: (duration) => number
``` ```
## Algebra
### add ### add
``` ```
add: (duration, duration) => duration add: (duration, duration) => duration

View File

@ -10,7 +10,7 @@ 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)
@ -30,7 +30,7 @@ length: (list<'a>) => number
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).

View File

@ -3,6 +3,10 @@ sidebar_position: 9
title: Number title: Number
--- ---
import TOCInline from "@theme/TOCInline";
<TOCInline toc={toc} />
### ceil ### ceil
```javascript ```javascript
@ -27,6 +31,8 @@ abs: (number) => number
round: (number) => number round: (number) => number
``` ```
## Statistics
### max ### max
```javascript ```javascript
@ -57,6 +63,8 @@ stdev: (list<number>) => number
variance: (list<number>) => number variance: (list<number>) => number
``` ```
## Algebra
### unaryMinus ### unaryMinus
```javascript ```javascript