Skip to content

Commit

Permalink
Moved scale and sym to generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
OAGr committed Jan 1, 2024
1 parent 24ffa58 commit 37d050b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 91 deletions.
10 changes: 10 additions & 0 deletions packages/squiggle-lang/src/fr/scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ export const library = [
name: "symlog",
output: "Scale",
examples: [`Scale.symlog({ min: -10, max: 10 })`],
description: `Symmetric log scale. Useful for plotting data that includes zero or negative values.
The function accepts an additional \`constant\` parameter, used as follows: \`Scale.symlog({constant: 0.1})\`. This parameter allows you to allocate more pixel space to data with lower or higher absolute values. By adjusting this constant, you effectively control the scale's focus, shifting it between smaller and larger values. For more detailed information on this parameter, refer to the [D3 Documentation](https://d3js.org/d3-scale/symlog).
The default value for \`constant\` is \`${0.0001}\`.`, // I tried to set this to the default value in the code, but this gave webpack in the Website.
definitions: [
makeDefinition(
[
Expand Down Expand Up @@ -144,6 +149,9 @@ export const library = [
name: "power",
output: "Scale",
examples: [`Scale.power({ min: 1, max: 100, exponent: 0.1 })`],
description: `Power scale. Accepts an extra \`exponent\` parameter, like, \`Scale.power({exponent: 2, min: 0, max: 100})\`.
The default value for \`exponent\` is \`${0.1}\`.`,
definitions: [
makeDefinition(
[
Expand Down Expand Up @@ -181,6 +189,8 @@ export const library = [
name: "date",
output: "Scale",
examples: ["Scale.date({ min: Date(2022), max: Date(2025) })"],
description:
"Scale for dates. Only works on Date values. Is a linear scale under the hood.",
definitions: [
makeDefinition(
[dateDict],
Expand Down
2 changes: 2 additions & 0 deletions packages/squiggle-lang/src/fr/sym.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ export const library: FRFunction[] = [
name: "pointMass",
requiresNamespace: false,
examples: ["pointMass(0.5)"],
description:
"Point mass distributions are already symbolic, so you can use the regular `pointMass` function.",
definitions: [
makeDefinition([frNumber], frDistSymbolic, ([v]) => {
const result = SymbolicDist.PointMass.make(v);
Expand Down
2 changes: 2 additions & 0 deletions packages/website/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
/src/pages/docs/Api/Dict.mdx
/src/pages/docs/Api/SampleSet.mdx
/src/pages/docs/Api/PointSet.mdx
/src/pages/docs/Api/Sym.mdx
/src/pages/docs/Api/Scale.mdx
/src/pages/docs/Ecosystem/LLMPrompt.md
/public/llms/documentationBundle.txt
15 changes: 15 additions & 0 deletions packages/website/scripts/generateModulePages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,21 @@ All regular distribution function work on sample set distributions. In addition,
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.`,
},
{
name: "Sym",
description:
"The Sym module provides functions to create some common symbolic distributions.",
imports: `import { FnDocumentationFromName } from "@quri/squiggle-components";`,
intro: `Symbolic Distributions. All these functions match the functions for creating sample set distributions, but produce symbolic distributions instead. Symbolic distributions won't capture correlations, but are more performant than sample distributions.`,
},
{
name: "Scale",
description: "Scales for plots.",
imports: `import { FnDocumentationFromName } from "@quri/squiggle-components";`,
intro: `Chart axes in [plots](./Plot.mdx) can be scaled using the following functions. Each scale function accepts optional min and max value. Power scale accepts an extra exponent parameter.
Squiggle uses D3 for the tick formats. You can read about d3 tick formats [here](https://github.com/d3/d3-format).`,
},
];

function toMarkdownDefinitions(definitions) {
Expand Down
62 changes: 0 additions & 62 deletions packages/website/src/pages/docs/Api/Scale.mdx

This file was deleted.

29 changes: 0 additions & 29 deletions packages/website/src/pages/docs/Api/Sym.mdx

This file was deleted.

0 comments on commit 37d050b

Please sign in to comment.