Merged with develop

This commit is contained in:
Ozzie Gooen 2022-04-15 16:32:22 -04:00
commit 20f93539ad
13 changed files with 34 additions and 176 deletions

1
.github/CODEOWNERS vendored
View File

@ -24,6 +24,7 @@
*.json @quinn-dougherty @Hazelfire @OAGr *.json @quinn-dougherty @Hazelfire @OAGr
*.y*ml @quinn-dougherty @OAGr *.y*ml @quinn-dougherty @OAGr
*.config.js @Hazelfire @OAGr *.config.js @Hazelfire @OAGr
netlify.toml @quinn-dougherty @OAGr @Hazelfire
# Documentation # Documentation
*.md @quinn-dougherty @OAGr @Hazelfire *.md @quinn-dougherty @OAGr @Hazelfire

View File

@ -6,7 +6,6 @@ labels: "ops & testing"
# Description: # Description:
# The OS and version, yarn version, etc. in which this came up # The OS and version, yarn version, etc. in which this came up
<!-- delete this section if testing task or otherwise not applicable --> <!-- delete this section if testing task or otherwise not applicable -->

View File

@ -1,6 +1,6 @@
--- ---
name: Bug reports for Squiggle users name: Bug reports for Squiggle users
about: Rendering oddly, trouble with the playground, something like this? about: Rendering oddly? Is there a mathematical correctness problem?
labels: "bug" labels: "bug"
--- ---

View File

@ -42,17 +42,6 @@ yarn
See `packages/*/README.md` to work with whatever project you're interested in. See `packages/*/README.md` to work with whatever project you're interested in.
## `codium` for `rescript`
If you have `nix` installed with `flakes` enabled, you can build a `codium` in this repo for `rescript` development, if you don't want to pollute your machine's global editor with another mode/extension.
```sh
nix develop
codium
```
The `nix develop` shell also provides `yarn`.
# Contributing # Contributing
See `CONTRIBUTING.md`. See `CONTRIBUTING.md`.

View File

@ -1,9 +0,0 @@
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
inherit (lock.nodes.flake-compat.locked) owner repo rev narHash;
flake-compat = builtins.fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
sha256 = narHash;
};
in
import flake-compat { src = ./.; }

View File

@ -1,44 +0,0 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1641205782,
"narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1647893727,
"narHash": "sha256-pOi7VdCb+s5Cwh5CS7YEZVRgH9uCmE87J5W7iXv29Ck=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "1ec61dd4167f04be8d05c45780818826132eea0d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@ -1,94 +0,0 @@
{
description = "Building codium for rescript development";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs =
{ self
, nixpkgs
, flake-compat
}:
let
# Generate a user-friendly version number.
version = builtins.substring 0 8 self.lastModifiedDate;
# System types to support.
supportedSystems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system:
import nixpkgs {
inherit system;
overlays = [ self.overlay ];
});
in
{
overlay = final: prev: { };
# the default devShell used when running `nix develop`
devShell = forAllSystems (system: self.devShells.${system}.defaultShell);
devShells = forAllSystems (system:
let
pkgs = nixpkgsFor."${system}";
in
{
# In case we don't want to provide an editor, this defaultShell will provide only coq packages we need.
defaultShell = pkgs.mkShell {
buildInputs = with pkgs; [
yarn
yarn2nix
nodePackages.npm
nodejs
patchelf
(pkgs.vscode-with-extensions.override {
vscode = pkgs.vscodium;
vscodeExtensions = pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "rescript-vscode";
publisher = "chenglou92";
version = "1.2.1";
sha256 = "sha256-7/YakKtJ4WhgAR4rZltrq8g4TtM5QZ2spbrEUrNoXVg=";
}
{
name = "vim";
publisher = "vscodevim";
version = "1.22.2";
sha256 = "sha256-dtIlgODzRdoMKnG9050ZcCX3w15A/R3FaMc+ZylvBbU=";
}
{
name = "vscode-typescript-next";
publisher = "ms-vscode";
version = "4.7.20220323";
sha256 = "sha256-mjiBCyg5As/XAU9I5k6jEZWGJA3P6P5o1roe2bS7aUI=";
}
{
name = "nix-ide";
publisher = "jnoortheen";
version = "0.1.20";
sha256 = "sha256-Q6X41I68m0jaCXaQGEFOoAbSUrr/wFhfCH5KrduOtZo=";
}
{
name = "json";
publisher = "ZainChen";
version = "2.0.2";
sha256 = "sha256-nC3Q8KuCtn/jg1j/NaAxWGvnKe/ykrPm2PUjfsJz8aI=";
}
{
name = "prettier-vscode";
publisher = "esbenp";
version = "9.3.0";
sha256 = "sha256-hJgPjWf7a8+ltjmXTK8U/MwqgIZqBjmcCfHsAk2G3PA=";
}
];
})
];
};
}
);
};
}

View File

@ -0,0 +1,8 @@
[build]
base = "packages/components/"
command = "cd ../squiggle-lang && yarn build && cd ../components && yarn build"
publish = "storybook-static/"
ignore = "node -e 'process.exitCode = process.env.BRANCH.includes(\"dependabot\") ? 0 : 1' && git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../squiggle-lang"
[build.environment]
NETLIFY_USE_YARN = "true"

View File

@ -11,13 +11,13 @@
"@types/lodash": "^4.14.181", "@types/lodash": "^4.14.181",
"@types/node": "^17.0.24", "@types/node": "^17.0.24",
"@types/react": "^18.0.3", "@types/react": "^18.0.3",
"@types/react-dom": "^18.0.0",
"@types/styled-components": "^5.1.25", "@types/styled-components": "^5.1.25",
"@types/react-dom": "^18.0.1",
"antd": "^4.19.3", "antd": "^4.19.3",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"react": "^18.0.0", "react": "^18.0.0",
"react-ace": "9.5.0", "react-ace": "10.0.0",
"react-dom": "^18.0.0", "react-dom": "^18.0.0",
"react-scripts": "5.0.1", "react-scripts": "5.0.1",
"react-vega": "^7.5.0", "react-vega": "^7.5.0",

View File

@ -63,8 +63,8 @@ describe("eval on distribution functions", () => {
testEval("lognormal(5, 2) * 2", "Ok(Lognormal(5.693147180559945,2))") testEval("lognormal(5, 2) * 2", "Ok(Lognormal(5.693147180559945,2))")
}) })
describe("division", () => { describe("division", () => {
testEval("lognormal(5,2) / lognormal(10,2)", "Ok(Lognormal(-5,4))") testEval("lognormal(5,2) / lognormal(10,2)", "Ok(Lognormal(-5,2.8284271247461903))")
testEval("lognormal(10,2) / lognormal(5,2)", "Ok(Lognormal(5,4))") testEval("lognormal(10,2) / lognormal(5,2)", "Ok(Lognormal(5,2.8284271247461903))")
testEval("lognormal(5, 2) / 2", "Ok(Lognormal(4.306852819440055,2))") testEval("lognormal(5, 2) / 2", "Ok(Lognormal(4.306852819440055,2))")
testEval("2 / lognormal(5, 2)", "Ok(Lognormal(-4.306852819440055,2))") testEval("2 / lognormal(5, 2)", "Ok(Lognormal(-4.306852819440055,2))")
testEval("2 / normal(10, 2)", "Ok(Point Set Distribution)") testEval("2 / normal(10, 2)", "Ok(Point Set Distribution)")

View File

@ -160,14 +160,14 @@ module Lognormal = {
let multiply = (l1, l2) => { let multiply = (l1, l2) => {
// https://wikiless.org/wiki/Log-normal_distribution?lang=en#Multiplication_and_division_of_independent,_log-normal_random_variables // https://wikiless.org/wiki/Log-normal_distribution?lang=en#Multiplication_and_division_of_independent,_log-normal_random_variables
let mu = l1.mu +. l2.mu let mu = l1.mu +. l2.mu
let sigma = Js.Math.sqrt(l1.sigma ** 2. +. l2.sigma ** 2.) // m let sigma = Js.Math.sqrt(l1.sigma ** 2. +. l2.sigma ** 2.)
#Lognormal({mu: mu, sigma: sigma}) #Lognormal({mu: mu, sigma: sigma})
} }
let divide = (l1, l2) => { let divide = (l1, l2) => {
let mu = l1.mu -. l2.mu let mu = l1.mu -. l2.mu
// We believe the ratiands will have covariance zero. // We believe the ratiands will have covariance zero.
// See here https://stats.stackexchange.com/questions/21735/what-are-the-mean-and-variance-of-the-ratio-of-two-lognormal-variables for details // See here https://stats.stackexchange.com/questions/21735/what-are-the-mean-and-variance-of-the-ratio-of-two-lognormal-variables for details
let sigma = l1.sigma +. l2.sigma let sigma = Js.Math.sqrt(l1.sigma ** 2. +. l2.sigma ** 2.)
#Lognormal({mu: mu, sigma: sigma}) #Lognormal({mu: mu, sigma: sigma})
} }
let operate = (operation: Operation.Algebraic.t, n1: t, n2: t) => let operate = (operation: Operation.Algebraic.t, n1: t, n2: t) =>

View File

@ -0,0 +1,8 @@
[build]
base = "packages/website/"
command = "cd ../squiggle-lang && yarn build && cd ../website && yarn build"
publish = "build/"
ignore = "node -e 'process.exitCode = process.env.BRANCH.includes(\"dependabot\") ? 0 : 1' && git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF ../"
[build.environment]
NETLIFY_USE_YARN = "true"

View File

@ -4034,10 +4034,10 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc" resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc"
integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==
"@types/react-dom@^18.0.0": "@types/react-dom@^18.0.0", "@types/react-dom@^18.0.1":
version "18.0.0" version "18.0.1"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.0.tgz#b13f8d098e4b0c45df4f1ed123833143b0c71141" resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.1.tgz#cb3cc10ea91141b12c71001fede1017acfbce4db"
integrity sha512-49897Y0UiCGmxZqpC8Blrf6meL8QUla6eb+BBhn69dTXlmuOlzkfr7HHY/O8J25e1lTUMs+YYxSlVDAaGHCOLg== integrity sha512-jCwTXvHtRLiyVvKm9aEdHXs8rflVOGd5Sl913JZrPshfXjn8NYsTNZOz70bCsA31IR0TOqwi3ad+X4tSCBoMTw==
dependencies: dependencies:
"@types/react" "*" "@types/react" "*"
@ -4631,7 +4631,7 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8:
mime-types "~2.1.34" mime-types "~2.1.34"
negotiator "0.6.3" negotiator "0.6.3"
ace-builds@^1.4.13: ace-builds@^1.4.14:
version "1.4.14" version "1.4.14"
resolved "https://registry.yarnpkg.com/ace-builds/-/ace-builds-1.4.14.tgz#2c41ccbccdd09e665d3489f161a20baeb3a3c852" resolved "https://registry.yarnpkg.com/ace-builds/-/ace-builds-1.4.14.tgz#2c41ccbccdd09e665d3489f161a20baeb3a3c852"
integrity sha512-NBOQlm9+7RBqRqZwimpgquaLeTJFayqb9UEPtTkpC3TkkwDnlsT/TwsCC0svjt9kEZ6G9mH5AEOHSz6Q/HrzQQ== integrity sha512-NBOQlm9+7RBqRqZwimpgquaLeTJFayqb9UEPtTkpC3TkkwDnlsT/TwsCC0svjt9kEZ6G9mH5AEOHSz6Q/HrzQQ==
@ -14064,12 +14064,12 @@ rc@^1.2.8:
minimist "^1.2.0" minimist "^1.2.0"
strip-json-comments "~2.0.1" strip-json-comments "~2.0.1"
react-ace@9.5.0: react-ace@10.0.0:
version "9.5.0" version "10.0.0"
resolved "https://registry.yarnpkg.com/react-ace/-/react-ace-9.5.0.tgz#b6c32b70d404dd821a7e01accc2d76da667ff1f7" resolved "https://registry.yarnpkg.com/react-ace/-/react-ace-10.0.0.tgz#1760e302604cff35ba40963db43eb027513b6572"
integrity sha512-4l5FgwGh6K7A0yWVMQlPIXDItM4Q9zzXRqOae8KkCl6MkOob7sC1CzHxZdOGvV+QioKWbX2p5HcdOVUv6cAdSg== integrity sha512-AUoA2OsKOCv8fXLqcFM232dF/Z8w14bwPUZ9z5I2zjBfqfZOZLqxnhXN+qKL6VrQXs1DLUvalGOuM5TABAFOCA==
dependencies: dependencies:
ace-builds "^1.4.13" ace-builds "^1.4.14"
diff-match-patch "^1.0.5" diff-match-patch "^1.0.5"
lodash.get "^4.4.2" lodash.get "^4.4.2"
lodash.isequal "^4.5.0" lodash.isequal "^4.5.0"