From 2d4d8a8f4de8d5b507d45ebffdc20bb4c05e0b49 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sat, 11 Jun 2022 08:28:38 -0700 Subject: [PATCH] Attempting to make all api docs formatting mostly consistent --- packages/website/docs/Api/Dictionary.md | 2 +- packages/website/docs/Api/DistGeneric.mdx | 78 +++++++++---------- .../docs/Api/{Duration.md => Duration.mdx} | 8 ++ packages/website/docs/Api/List.md | 4 +- .../docs/Api/{Number.md => Number.mdx} | 8 ++ 5 files changed, 58 insertions(+), 42 deletions(-) rename packages/website/docs/Api/{Duration.md => Duration.mdx} (88%) rename packages/website/docs/Api/{Number.md => Number.mdx} (93%) diff --git a/packages/website/docs/Api/Dictionary.md b/packages/website/docs/Api/Dictionary.md index 6d0a2cbf..a31ba8ad 100644 --- a/packages/website/docs/Api/Dictionary.md +++ b/packages/website/docs/Api/Dictionary.md @@ -32,7 +32,7 @@ Dict.keys({foo: 3, bar: 20}) // ["foo", "bar"] Dict.values: (dict<'a>) => list<'a> ``` ```js -Dict.values({foo: 3, bar: 20}) // [3,20] +Dict.values({foo: 3, bar: 20}) // [3, 20] ``` ### merge diff --git a/packages/website/docs/Api/DistGeneric.mdx b/packages/website/docs/Api/DistGeneric.mdx index 5b3869f2..859f53db 100644 --- a/packages/website/docs/Api/DistGeneric.mdx +++ b/packages/website/docs/Api/DistGeneric.mdx @@ -222,7 +222,7 @@ toDiscretePointSet([ ### mixture ```javascript -mixture: (...distributionLike, weights:list):distribution +mixture: (...distributionLike, weights:list) => distribution ``` **Examples** @@ -237,7 +237,7 @@ mx(normal(5, 1), normal(10, 1), [0.3, 0.7]); Get one random sample from the distribution ```javascript -sample(distribution):number +sample(distribution) => number ``` **Examples** @@ -265,7 +265,7 @@ sample: (normal(5, 2), 100); Get the distribution mean ```javascript -mean: (distribution):number +mean: (distribution) => number ``` **Examples** @@ -277,25 +277,25 @@ mean: (normal(5, 2)); ### stdev ```javascript -stdev: (distribution):number +stdev: (distribution) => number ``` ### variance ```javascript -variance: (distribution):number +variance: (distribution) => number ``` ### mode ```javascript -mode: (distribution):number +mode: (distribution) => number ``` ### cdf ```javascript -cdf: (distribution, number):number +cdf: (distribution, number) => number ``` **Examples** @@ -307,7 +307,7 @@ cdf: (normal(5, 2), 3); ### pdf ```javascript -pdf: (distribution, number):number +pdf: (distribution, number) => number ``` **Examples** @@ -319,7 +319,7 @@ pdf: (normal(5, 2), 3); ### inv ```javascript -inv: (distribution, number):number +inv: (distribution, number) => number ``` **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. ```javascript -truncateLeft: (distribution, l:number):distribution +truncateLeft: (distribution, l => number) => distribution ``` **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. ```javascript -truncateRight: (distribution, r:number):distribution +truncateRight: (distribution, r => number) => distribution ``` **Examples** @@ -391,7 +391,7 @@ truncateLeft(normal(5, 2), 6); Kullback–Leibler divergence between two distributions ```javascript -klDivergence: (distribution, distribution):number +klDivergence: (distribution, distribution) => number ``` **Examples** @@ -405,7 +405,7 @@ klDivergence(normal(5, 2), normal(5, 4)); // returns 0.57 ### toString ```javascript -: (distribution):string +: (distribution) => string ``` **Examples** @@ -419,7 +419,7 @@ toString(normal(5, 2)); Produce a sparkline of length n ```javascript -toSparkline: (distribution, n=20):string +toSparkline: (distribution, n=20) => string ``` **Examples** @@ -433,7 +433,7 @@ toSparkline(normal(5, 2), 10); Prints the value of the distribution to the Javascript console, then returns the distribution. ```javascript -inspect: (distribution):distribution +inspect: (distribution) => distribution ``` **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. ```javascript -normalize: (distribution):distribution +normalize: (distribution) => distribution ``` **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. ```javascript -integralSum: (distribution):number +integralSum: (distribution) => number ``` **Examples** @@ -491,67 +491,67 @@ integralSum(normal(5, 2)); ### add ```javascript -add: (distributionLike, distributionLike): distribution +add: (distributionLike, distributionLike) => distribution ``` ### sum ```javascript -sum: (list): distribution +sum: (list) => distribution ``` ### multiply ```javascript -multiply: (distributionLike, distributionLike): distribution +multiply: (distributionLike, distributionLike) => distribution ``` ### product ```javascript -product: (list): distribution +product: (list) => distribution ``` ### subtract ```javascript -subtract: (distributionLike, distributionLike): distribution +subtract: (distributionLike, distributionLike) => distribution ``` ### divide ```javascript -divide: (distributionLike, distributionLike): distribution +divide: (distributionLike, distributionLike) => distribution ``` ### pow ```javascript -pow: (distributionLike, distributionLike): distribution +pow: (distributionLike, distributionLike) => distribution ``` ### exp ```javascript -exp: (distributionLike, distributionLike): distribution +exp: (distributionLike, distributionLike) => distribution ``` ### log ```javascript -log: (distributionLike, distributionLike): distribution +log: (distributionLike, distributionLike) => distribution ``` ### log10 ```javascript -log10: (distributionLike, distributionLike):distribution +log10: (distributionLike, distributionLike) => distribution ``` ### unaryMinus ```javascript -unaryMinus: (distribution):distribution +unaryMinus: (distribution) => distribution ``` ## Pointwise Operations @@ -559,37 +559,37 @@ unaryMinus: (distribution):distribution ### dotAdd ```javascript -dotAdd: (distributionLike, distributionLike): distribution +dotAdd: (distributionLike, distributionLike) => distribution ``` ### dotMultiply ```javascript -dotMultiply: (distributionLike, distributionLike): distribution +dotMultiply: (distributionLike, distributionLike) => distribution ``` ### dotSubtract ```javascript -dotSubtract: (distributionLike, distributionLike): distribution +dotSubtract: (distributionLike, distributionLike) => distribution ``` ### dotDivide ```javascript -dotDivide: (distributionLike, distributionLike): distribution +dotDivide: (distributionLike, distributionLike) => distribution ``` ### dotPow ```javascript -dotPow: (distributionLike, distributionLike): distribution +dotPow: (distributionLike, distributionLike) => distribution ``` ### dotExp ```javascript -dotExp: (distributionLike, distributionLike): distribution +dotExp: (distributionLike, distributionLike) => distribution ``` ## Scale Operations @@ -597,31 +597,31 @@ dotExp: (distributionLike, distributionLike): distribution ### scaleMultiply ```javascript -scaleMultiply: (distributionLike, number): distribution +scaleMultiply: (distributionLike, number) => distribution ``` ### scalePow ```javascript -scalePow: (distributionLike, number): distribution +scalePow: (distributionLike, number) => distribution ``` ### scaleExp ```javascript -scaleExp: (distributionLike, number): distribution +scaleExp: (distributionLike, number) => distribution ``` ### scaleLog ```javascript -scaleLog: (distributionLike, number): distribution +scaleLog: (distributionLike, number) => distribution ``` ### scaleLog10 ```javascript -scaleLog10: (distributionLike, number): distribution +scaleLog10: (distributionLike, number) => distribution ``` ## Special diff --git a/packages/website/docs/Api/Duration.md b/packages/website/docs/Api/Duration.mdx similarity index 88% rename from packages/website/docs/Api/Duration.md rename to packages/website/docs/Api/Duration.mdx index 57df9d65..52c50130 100644 --- a/packages/website/docs/Api/Duration.md +++ b/packages/website/docs/Api/Duration.mdx @@ -3,11 +3,17 @@ sidebar_position: 6 title: Duration --- +import TOCInline from "@theme/TOCInline"; + + + ### toString ``` toString: (duration) => string ``` +## Units + ### minutes ``` minutes: (number) => duration @@ -48,6 +54,8 @@ toDays: (duration) => number toYears: (duration) => number ``` +## Algebra + ### add ``` add: (duration, duration) => duration diff --git a/packages/website/docs/Api/List.md b/packages/website/docs/Api/List.md index 06623b20..9a1e880b 100644 --- a/packages/website/docs/Api/List.md +++ b/packages/website/docs/Api/List.md @@ -10,7 +10,7 @@ List.make: (number, 'a) => list<'a> Returns an array of size ``n`` filled with value ``e``. ```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) @@ -30,7 +30,7 @@ length: (list<'a>) => number List.upTo: (low:number, high:number) => list ``` ```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). diff --git a/packages/website/docs/Api/Number.md b/packages/website/docs/Api/Number.mdx similarity index 93% rename from packages/website/docs/Api/Number.md rename to packages/website/docs/Api/Number.mdx index dcd10752..e544b4f6 100644 --- a/packages/website/docs/Api/Number.md +++ b/packages/website/docs/Api/Number.mdx @@ -3,6 +3,10 @@ sidebar_position: 9 title: Number --- +import TOCInline from "@theme/TOCInline"; + + + ### ceil ```javascript @@ -27,6 +31,8 @@ abs: (number) => number round: (number) => number ``` +## Statistics + ### max ```javascript @@ -57,6 +63,8 @@ stdev: (list) => number variance: (list) => number ``` +## Algebra + ### unaryMinus ```javascript