From 100ec2c1a8b3c023d4cdbc991d66fb3d41e20b26 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Tue, 19 Jul 2022 16:18:28 -0700 Subject: [PATCH] Adjusting documentation to reflect new functions --- .../FunctionRegistry/Library/FR_Sampleset.res | 2 +- packages/website/docs/Api/Date.md | 14 +++++----- packages/website/docs/Api/DistGeneric.mdx | 26 +----------------- packages/website/docs/Api/DistPointSet.md | 8 ------ packages/website/docs/Api/Function.md | 27 +++++++++++++++++++ packages/website/docs/Api/List.md | 6 +---- 6 files changed, 36 insertions(+), 47 deletions(-) create mode 100644 packages/website/docs/Api/Function.md diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Sampleset.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Sampleset.res index e92551da..b5064352 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Sampleset.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Sampleset.res @@ -172,7 +172,7 @@ let library = [ ~nameSpace, ~requiresNamespace, ~examples=[ - `Sampleset.mapN([Sampleset.maker(normal(5,2)), Sampleset.maker(normal(5,2)), Sampleset.maker(normal(5,2))], {|x| max(x)`, + `Sampleset.mapN([Sampleset.maker(normal(5,2)), Sampleset.maker(normal(5,2)), Sampleset.maker(normal(5,2))], {|x| max(x)})`, ], ~output=ReducerInterface_InternalExpressionValue.EvtDistribution, ~definitions=[ diff --git a/packages/website/docs/Api/Date.md b/packages/website/docs/Api/Date.md index 9f9b9f09..eef71ea0 100644 --- a/packages/website/docs/Api/Date.md +++ b/packages/website/docs/Api/Date.md @@ -5,16 +5,14 @@ title: Date Squiggle date types are a very simple implementation on [Javascript's Date type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date). It's mainly here for early experimentation. There are more relevant functions for the [Duration](/docs/Api/Duration) type. -### makeFromYear - -(Now `makeDateFromYear`) +### fromYear ``` -Date.makeFromYear: (number) => date +Date.fromYear: (number) => date ``` ```js -makeFromYear(2022.32); +Date.fromYear(2022.32); ``` ### toString @@ -30,7 +28,7 @@ add: (date, duration) => date ``` ```js -makeFromYear(2022.32) + years(5); +Date.fromYear(2022.32) + years(5); ``` ### subtract @@ -41,6 +39,6 @@ subtract: (date, duration) => date ``` ```js -makeFromYear(2040) - makeFromYear(2020); // 20 years -makeFromYear(2040) - years(20); // 2020 +Date.fromYear(2040) - Date.fromYear(2020); // 20 years +Date.fromYear(2040) - years(20); // 2020 ``` diff --git a/packages/website/docs/Api/DistGeneric.mdx b/packages/website/docs/Api/DistGeneric.mdx index 42f464df..a96a6a1e 100644 --- a/packages/website/docs/Api/DistGeneric.mdx +++ b/packages/website/docs/Api/DistGeneric.mdx @@ -653,28 +653,4 @@ scaleLog: (distributionLike, number) => distribution ``` scaleLog10: (distributionLike, number) => distribution -``` - -## Special - -### Declaration (Continuous Functions) - -Adds metadata to a function of the input ranges. Works now for numeric and date inputs. This is useful when making formal predictions. It allows you to limit the domain that your prediction will be used and scored within. - -Declarations are currently experimental and will likely be removed or changed in the future. - -``` -declareFn: (dict<{fn: lambda, inputs: array>}>) => declaration -``` - -**Examples** - -```javascript -declareFn({ - fn: {|a,b| a }, - inputs: [ - {min: 0, max: 100}, - {min: 30, max: 50} - ] -}) -``` +``` \ No newline at end of file diff --git a/packages/website/docs/Api/DistPointSet.md b/packages/website/docs/Api/DistPointSet.md index b4c4ba81..f9117eb9 100644 --- a/packages/website/docs/Api/DistPointSet.md +++ b/packages/website/docs/Api/DistPointSet.md @@ -3,10 +3,6 @@ sidebar_position: 4 title: Point Set Distribution --- -:::danger -These functions aren't yet implemented with these specific names. This should be changed soon -::: - Point set distributions are one of the three distribution formats. They are stored as a list of x-y coordinates representing both discrete and continuous distributions. One complication is that it's possible to represent invalid probability distributions in the point set format. For example, you can represent shapes with negative values, or shapes that are not normalized. @@ -21,8 +17,6 @@ PointSet.make: (distribution) => pointSetDist ### makeContinuous -**TODO: Now called "toContinuousPointSet"** - Converts a set of x-y coordinates directly into a continuous distribution. ``` @@ -40,8 +34,6 @@ PointSet.makeContinuous([ ### makeDiscrete -**TODO: Now called "toDiscretePointSet"** - Converts a set of x-y coordinates directly into a discrete distribution. ``` diff --git a/packages/website/docs/Api/Function.md b/packages/website/docs/Api/Function.md new file mode 100644 index 00000000..b1c53ea3 --- /dev/null +++ b/packages/website/docs/Api/Function.md @@ -0,0 +1,27 @@ +--- +sidebar_position: 6 +title: Function +--- + +## declare (experimental) + +Adds metadata to a function of the input ranges. Works now for numeric and date inputs. This is useful when making formal predictions. It allows you to limit the domain that your prediction will be used and scored within. + +The one function that declarations currently have is that they impact plotting. If you ``declare`` a single-variable function within a specific range, this specific range will be plotted. + +Declarations are currently experimental and will likely be removed or changed in the future. + +``` +Function.declare: (dict<{fn: lambda, inputs: array>}>) => declaration +``` + +**Examples** + +```javascript +Function.declare({ + fn: {|a| a+10 }, + inputs: [ + {min: 30, max: 100} + ] +}) +``` \ No newline at end of file diff --git a/packages/website/docs/Api/List.md b/packages/website/docs/Api/List.md index 47d5f450..1a8ef7a8 100644 --- a/packages/website/docs/Api/List.md +++ b/packages/website/docs/Api/List.md @@ -11,8 +11,6 @@ myList = [3, normal(5, 2), "random"]; ### make -**Note: currently just called `makeList`, without the preix** - ``` List.make: (number, 'a) => list<'a> ``` @@ -37,9 +35,7 @@ toString: (list<'a>) => string length: (list<'a>) => number ``` -### up to - -**Note: currently just called `upTo`, without the preix** +### upTo ``` List.upTo: (low:number, high:number) => list