@explorable-viz/fluid 0.7.89 → 0.7.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +11 -6
  2. package/dist/fluid/fluid/lib/matrix.fld +39 -0
  3. package/dist/fluid/fluid/lib/prelude.fld +2 -2
  4. package/dist/fluid/fluid/lib/stats.fld +21 -22
  5. package/dist/fluid/shared/fluid.mjs +2675 -4251
  6. package/dist/fluid/shared/load-figure.js +6191 -5613
  7. package/dist/fluid/shared/webtest-lib.js +16 -16
  8. package/package.json +2 -1
  9. package/.spago/argonaut/v9.0.0/.editorconfig +0 -13
  10. package/.spago/argonaut/v9.0.0/.gitignore +0 -9
  11. package/.spago/argonaut/v9.0.0/.tidyrc.json +0 -10
  12. package/.spago/argonaut-traversals/v10.0.0/.editorconfig +0 -13
  13. package/.spago/argonaut-traversals/v10.0.0/.gitignore +0 -9
  14. package/.spago/argonaut-traversals/v10.0.0/.tidyrc.json +0 -10
  15. package/.spago/avar/v5.0.0/.editorconfig +0 -13
  16. package/.spago/avar/v5.0.0/.eslintrc.json +0 -29
  17. package/.spago/avar/v5.0.0/.gitignore +0 -14
  18. package/.spago/avar/v5.0.0/.tidyrc.json +0 -10
  19. package/.spago/fork/v6.0.0/.editorconfig +0 -13
  20. package/.spago/fork/v6.0.0/.gitignore +0 -9
  21. package/.spago/fork/v6.0.0/.tidyrc.json +0 -10
  22. package/.spago/node-http/v8.0.0/.eslintrc.json +0 -29
  23. package/.spago/node-http/v8.0.0/.gitignore +0 -8
  24. package/.spago/node-net/v4.0.0/.eslintrc.json +0 -29
  25. package/.spago/node-net/v4.0.0/.gitignore +0 -8
  26. package/.spago/node-process/v11.0.0/.eslintrc.json +0 -29
  27. package/.spago/node-process/v11.0.0/.gitignore +0 -8
  28. package/.spago/node-process/v11.1.0/.eslintrc.json +0 -29
  29. package/.spago/node-process/v11.1.0/.gitignore +0 -8
  30. package/.spago/node-process/v11.2.0/.eslintrc.json +0 -29
  31. package/.spago/node-process/v11.2.0/.gitignore +0 -8
  32. package/.spago/node-url/v6.0.0/.eslintrc.json +0 -26
  33. package/.spago/node-url/v6.0.0/.gitignore +0 -8
  34. package/.spago/options/v7.0.0/.editorconfig +0 -13
  35. package/.spago/options/v7.0.0/.gitignore +0 -9
  36. package/.spago/options/v7.0.0/.tidyrc.json +0 -10
  37. package/.spago/optparse/v6.0.0/.gitignore +0 -8
  38. package/.spago/optparse/v6.0.0/.npmrc +0 -1
  39. package/.spago/profunctor-lenses/v8.0.0/.editorconfig +0 -13
  40. package/.spago/profunctor-lenses/v8.0.0/.gitignore +0 -9
  41. package/.spago/profunctor-lenses/v8.0.0/.tidyrc.json +0 -10
  42. package/dist/fluid/fluid/lib/convolution.fld +0 -31
@@ -21307,8 +21307,8 @@ var init_ExposedFunction = __esm({
21307
21307
  return e.name = "SuppressedError", e.error = error3, e.suppressed = suppressed, e;
21308
21308
  });
21309
21309
  ExposeableFunction = class {
21310
- static async from(frame, name2, apply4, isolate = false) {
21311
- const func = new ExposeableFunction(frame, name2, apply4, isolate);
21310
+ static async from(frame, name2, apply3, isolate = false) {
21311
+ const func = new ExposeableFunction(frame, name2, apply3, isolate);
21312
21312
  await func.#initialize();
21313
21313
  return func;
21314
21314
  }
@@ -21319,10 +21319,10 @@ var init_ExposedFunction = __esm({
21319
21319
  #channel;
21320
21320
  #scripts = [];
21321
21321
  #disposables = new DisposableStack();
21322
- constructor(frame, name2, apply4, isolate = false) {
21322
+ constructor(frame, name2, apply3, isolate = false) {
21323
21323
  this.#frame = frame;
21324
21324
  this.name = name2;
21325
- this.#apply = apply4;
21325
+ this.#apply = apply3;
21326
21326
  this.#isolate = isolate;
21327
21327
  this.#channel = `__puppeteer__${this.#frame._id}_page_exposeFunction_${this.name}`;
21328
21328
  }
@@ -22794,11 +22794,11 @@ var init_Frame2 = __esm({
22794
22794
  return this.browsingContext.closed;
22795
22795
  }
22796
22796
  #exposedFunctions = /* @__PURE__ */ new Map();
22797
- async exposeFunction(name2, apply4) {
22797
+ async exposeFunction(name2, apply3) {
22798
22798
  if (this.#exposedFunctions.has(name2)) {
22799
22799
  throw new Error(`Failed to add page binding with name ${name2}: globalThis['${name2}'] already exists!`);
22800
22800
  }
22801
- const exposeable = await ExposeableFunction.from(this, name2, apply4);
22801
+ const exposeable = await ExposeableFunction.from(this, name2, apply3);
22802
22802
  this.#exposedFunctions.set(name2, exposeable);
22803
22803
  }
22804
22804
  async removeExposedFunction(name2) {
@@ -266734,7 +266734,7 @@ var traverseArrayImpl = function() {
266734
266734
  return xs.concat(ys);
266735
266735
  };
266736
266736
  }
266737
- return function(apply4) {
266737
+ return function(apply3) {
266738
266738
  return function(map3) {
266739
266739
  return function(pure) {
266740
266740
  return function(f) {
@@ -266746,12 +266746,12 @@ var traverseArrayImpl = function() {
266746
266746
  case 1:
266747
266747
  return map3(array1)(f(array[bot]));
266748
266748
  case 2:
266749
- return apply4(map3(array2)(f(array[bot])))(f(array[bot + 1]));
266749
+ return apply3(map3(array2)(f(array[bot])))(f(array[bot + 1]));
266750
266750
  case 3:
266751
- return apply4(apply4(map3(array3)(f(array[bot])))(f(array[bot + 1])))(f(array[bot + 2]));
266751
+ return apply3(apply3(map3(array3)(f(array[bot])))(f(array[bot + 1])))(f(array[bot + 2]));
266752
266752
  default:
266753
266753
  var pivot = bot + Math.floor((top2 - bot) / 4) * 2;
266754
- return apply4(map3(concat22)(go(bot, pivot)))(go(pivot, top2));
266754
+ return apply3(map3(concat22)(go(bot, pivot)))(go(pivot, top2));
266755
266755
  }
266756
266756
  }
266757
266757
  return go(0, array.length);
@@ -266905,11 +266905,11 @@ var traverse1Impl = function() {
266905
266905
  }
266906
266906
  return arr;
266907
266907
  }
266908
- return function(apply4) {
266908
+ return function(apply3) {
266909
266909
  return function(map3) {
266910
266910
  return function(f) {
266911
266911
  var buildFrom = function(x, ys) {
266912
- return apply4(map3(consList)(f(x)))(ys);
266912
+ return apply3(map3(consList)(f(x)))(ys);
266913
266913
  };
266914
266914
  var go = function(acc, currentLen, xs) {
266915
266915
  if (currentLen === 0) {
@@ -278702,7 +278702,7 @@ var waitFor = (selector2) => (page2) => {
278702
278702
  visible: true
278703
278703
  })(page2)))(() => _bind(_liftEffect(log2("-> found")))(() => report(true)("exists"))))((e) => report(false)(showErrorImpl(e))));
278704
278704
  };
278705
- var waitForFigure = (page2) => (id) => waitFor("svg#" + id)(page2);
278705
+ var waitForFigure = (page2) => (selector2) => waitFor("svg" + selector2)(page2);
278706
278706
  var waitForHidden = (selector2) => (page2) => _bind(_liftEffect(log2("Waiting for " + selector2)))(() => _bind(_map((v) => {
278707
278707
  })(runPromiseAffE3(_pageWaitForSelector)(selector2)({
278708
278708
  timeout: 24e4,
@@ -278716,9 +278716,9 @@ var $$goto = (v) => (page2) => _bind(_liftEffect(log2("Going to " + showStringIm
278716
278716
  var getAttributeValue = (page2) => (selector2) => (attribute) => _bind(runPromiseAffE3(_unsafePageEval)(selector2)("element => element.getAttribute('" + attribute + "')")(page2))((attrValue) => _pure(attrValue));
278717
278717
  var defaultViewport = { deviceScaleFactor: 1, hasTouch: false, height: 800, isLandscape: false, isMobile: false, width: 1200 };
278718
278718
  var click = (element) => (page2) => _bind(_bind(_liftEffect(_click(element, page2)))(toAff$p(coerce)))(() => testCondition2(element)(true)("click"));
278719
- var clickToggle = (page2) => (id) => {
278720
- const toggle = "div#" + id + " + div .toggle-button";
278721
- return _bind(waitFor(toggle)(page2))(() => click(toggle)(page2));
278719
+ var clickToggle = (page2) => (figId) => {
278720
+ const toggle = "div#" + figId + "-data-pane + div .toggle-button";
278721
+ return _bind(waitFor(toggle)(page2))(() => _bind(click(toggle)(page2))(() => waitFor("div#" + figId + "-data-pane")(page2)));
278722
278722
  };
278723
278723
  var checkTextContent = (page2) => (selector2) => (expected) => _bind(waitFor(selector2)(page2))(() => _bind(textContentValue(page2)(selector2))((text2) => _bind(testCondition2(selector2)(text2 === expected)("text == " + showStringImpl(expected)))(() => _pure())));
278724
278724
  var checkAttributeContains = (page2) => (sel) => (attr) => (expected) => _bind(getAttributeValue(page2)(sel)(attr))((found) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorable-viz/fluid",
3
- "version": "0.7.89",
3
+ "version": "0.7.90",
4
4
  "description": "Fluid is an experimental programming language which integrates a bidirectional dynamic analysis to connect outputs to data sources in a fine-grained way. Fluid is implemented in PureScript and runs in the browser.",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -30,6 +30,7 @@
30
30
  "build": "./script/build.sh",
31
31
  "build-test": "./script/build-test.sh",
32
32
  "bundle-fluid": "./script/bundle-fluid.sh",
33
+ "bundle-serve": "sh -c './script/bundle-website.sh -w \"$@\" && ./script/serve.sh \"$1\"' _",
33
34
  "bundle-website": "./script/bundle-website.sh",
34
35
  "fluid": "node ./dist/fluid/shared/fluid.mjs",
35
36
  "npm-publish": "./script/npm-publish.sh",
@@ -1,13 +0,0 @@
1
- # http://editorconfig.org
2
- root = true
3
-
4
- [*]
5
- indent_style = space
6
- indent_size = 2
7
- end_of_line = lf
8
- charset = utf-8
9
- trim_trailing_whitespace = true
10
- insert_final_newline = true
11
-
12
- [*.md]
13
- trim_trailing_whitespace = false
@@ -1,9 +0,0 @@
1
- .*
2
- !.gitignore
3
- !.github
4
- !.editorconfig
5
- !.tidyrc.json
6
-
7
- output
8
- generated-docs
9
- bower_components
@@ -1,10 +0,0 @@
1
- {
2
- "importSort": "source",
3
- "importWrap": "source",
4
- "indent": 2,
5
- "operatorsFile": null,
6
- "ribbon": 1,
7
- "typeArrowPlacement": "first",
8
- "unicode": "never",
9
- "width": null
10
- }
@@ -1,13 +0,0 @@
1
- # http://editorconfig.org
2
- root = true
3
-
4
- [*]
5
- indent_style = space
6
- indent_size = 2
7
- end_of_line = lf
8
- charset = utf-8
9
- trim_trailing_whitespace = true
10
- insert_final_newline = true
11
-
12
- [*.md]
13
- trim_trailing_whitespace = false
@@ -1,9 +0,0 @@
1
- .*
2
- !.gitignore
3
- !.github
4
- !.editorconfig
5
- !.tidyrc.json
6
-
7
- output
8
- generated-docs
9
- bower_components
@@ -1,10 +0,0 @@
1
- {
2
- "importSort": "source",
3
- "importWrap": "source",
4
- "indent": 2,
5
- "operatorsFile": null,
6
- "ribbon": 1,
7
- "typeArrowPlacement": "first",
8
- "unicode": "never",
9
- "width": null
10
- }
@@ -1,13 +0,0 @@
1
- # https://editorconfig.org
2
- root = true
3
-
4
- [*]
5
- indent_style = space
6
- indent_size = 2
7
- end_of_line = lf
8
- charset = utf-8
9
- trim_trailing_whitespace = true
10
- insert_final_newline = true
11
-
12
- [*.md]
13
- trim_trailing_whitespace = false
@@ -1,29 +0,0 @@
1
- {
2
- "env": { "browser": true },
3
- "extends": "eslint:recommended",
4
- "parserOptions": { "ecmaVersion": 6, "sourceType": "module" },
5
- "rules": {
6
- "block-scoped-var": "error",
7
- "consistent-return": "error",
8
- "eqeqeq": "error",
9
- "guard-for-in": "error",
10
- "no-bitwise": "error",
11
- "no-caller": "error",
12
- "no-extra-parens": "off",
13
- "no-extend-native": "error",
14
- "no-loop-func": "error",
15
- "no-new": "error",
16
- "no-param-reassign": "error",
17
- "no-return-assign": "error",
18
- "no-sequences": "error",
19
- "no-unused-expressions": "error",
20
- "no-use-before-define": "error",
21
- "no-undef": "error",
22
- "no-eq-null": "error",
23
- "radix": ["error", "always"],
24
- "indent": ["error", 2, { "SwitchCase": 1 }],
25
- "quotes": ["error", "double"],
26
- "semi": ["error", "always"],
27
- "strict": ["error", "global"]
28
- }
29
- }
@@ -1,14 +0,0 @@
1
- .*
2
- !.gitignore
3
- !.github
4
- !.editorconfig
5
- !.tidyrc.json
6
- !.eslintrc.json
7
-
8
- output
9
- generated-docs
10
- bower_components
11
-
12
- node_modules
13
- package-lock.json
14
- *.lock
@@ -1,10 +0,0 @@
1
- {
2
- "importSort": "source",
3
- "importWrap": "source",
4
- "indent": 2,
5
- "operatorsFile": null,
6
- "ribbon": 1,
7
- "typeArrowPlacement": "first",
8
- "unicode": "never",
9
- "width": null
10
- }
@@ -1,13 +0,0 @@
1
- # https://editorconfig.org
2
- root = true
3
-
4
- [*]
5
- indent_style = space
6
- indent_size = 2
7
- end_of_line = lf
8
- charset = utf-8
9
- trim_trailing_whitespace = true
10
- insert_final_newline = true
11
-
12
- [*.md]
13
- trim_trailing_whitespace = false
@@ -1,9 +0,0 @@
1
- .*
2
- !.gitignore
3
- !.github
4
- !.editorconfig
5
- !.tidyrc.json
6
-
7
- output
8
- generated-docs
9
- bower_components
@@ -1,10 +0,0 @@
1
- {
2
- "importSort": "source",
3
- "importWrap": "source",
4
- "indent": 2,
5
- "operatorsFile": null,
6
- "ribbon": 1,
7
- "typeArrowPlacement": "first",
8
- "unicode": "never",
9
- "width": null
10
- }
@@ -1,29 +0,0 @@
1
- {
2
- "parserOptions": {
3
- "ecmaVersion": 6,
4
- "sourceType": "module"
5
- },
6
- "extends": "eslint:recommended",
7
- "env": {
8
- "node": true
9
- },
10
- "rules": {
11
- "strict": [2, "global"],
12
- "block-scoped-var": 2,
13
- "consistent-return": 2,
14
- "eqeqeq": [2, "smart"],
15
- "guard-for-in": 2,
16
- "no-caller": 2,
17
- "no-extend-native": 2,
18
- "no-loop-func": 2,
19
- "no-new": 2,
20
- "no-param-reassign": 2,
21
- "no-return-assign": 2,
22
- "no-unused-expressions": 2,
23
- "no-use-before-define": 2,
24
- "radix": [2, "always"],
25
- "indent": [2, 2],
26
- "quotes": [2, "double"],
27
- "semi": [2, "always"]
28
- }
29
- }
@@ -1,8 +0,0 @@
1
- /.*
2
- !/.gitignore
3
- !/.eslintrc.json
4
- !/.github/
5
- /bower_components/
6
- /node_modules/
7
- /output/
8
- package-lock.json
@@ -1,29 +0,0 @@
1
- {
2
- "parserOptions": {
3
- "ecmaVersion": 6,
4
- "sourceType": "module"
5
- },
6
- "extends": "eslint:recommended",
7
- "env": {
8
- "node": true
9
- },
10
- "rules": {
11
- "strict": [2, "global"],
12
- "block-scoped-var": 2,
13
- "consistent-return": 2,
14
- "eqeqeq": [2, "smart"],
15
- "guard-for-in": 2,
16
- "no-caller": 2,
17
- "no-extend-native": 2,
18
- "no-loop-func": 2,
19
- "no-new": 2,
20
- "no-param-reassign": 2,
21
- "no-return-assign": 2,
22
- "no-unused-expressions": 2,
23
- "no-use-before-define": 2,
24
- "radix": [2, "always"],
25
- "indent": [2, 2],
26
- "quotes": [2, "double"],
27
- "semi": [2, "always"]
28
- }
29
- }
@@ -1,8 +0,0 @@
1
- /.*
2
- !/.gitignore
3
- !/.eslintrc.json
4
- !/.github/
5
- /bower_components/
6
- /node_modules/
7
- /output/
8
- package-lock.json
@@ -1,29 +0,0 @@
1
- {
2
- "parserOptions": {
3
- "ecmaVersion": 6,
4
- "sourceType": "module"
5
- },
6
- "extends": "eslint:recommended",
7
- "env": {
8
- "node": true
9
- },
10
- "rules": {
11
- "strict": [2, "global"],
12
- "block-scoped-var": 2,
13
- "consistent-return": 2,
14
- "eqeqeq": [2, "smart"],
15
- "guard-for-in": 2,
16
- "no-caller": 2,
17
- "no-extend-native": 2,
18
- "no-loop-func": 2,
19
- "no-new": 2,
20
- "no-param-reassign": 2,
21
- "no-return-assign": 2,
22
- "no-unused-expressions": 2,
23
- "no-use-before-define": 2,
24
- "radix": [2, "always"],
25
- "indent": [2, 2],
26
- "quotes": [2, "double"],
27
- "semi": [2, "always"]
28
- }
29
- }
@@ -1,8 +0,0 @@
1
- /.*
2
- !/.gitignore
3
- !/.eslintrc.json
4
- !/.github/
5
- /bower_components/
6
- /node_modules/
7
- /output/
8
- package-lock.json
@@ -1,29 +0,0 @@
1
- {
2
- "parserOptions": {
3
- "ecmaVersion": 6,
4
- "sourceType": "module"
5
- },
6
- "extends": "eslint:recommended",
7
- "env": {
8
- "node": true
9
- },
10
- "rules": {
11
- "strict": [2, "global"],
12
- "block-scoped-var": 2,
13
- "consistent-return": 2,
14
- "eqeqeq": [2, "smart"],
15
- "guard-for-in": 2,
16
- "no-caller": 2,
17
- "no-extend-native": 2,
18
- "no-loop-func": 2,
19
- "no-new": 2,
20
- "no-param-reassign": 2,
21
- "no-return-assign": 2,
22
- "no-unused-expressions": 2,
23
- "no-use-before-define": 2,
24
- "radix": [2, "always"],
25
- "indent": [2, 2],
26
- "quotes": [2, "double"],
27
- "semi": [2, "always"]
28
- }
29
- }
@@ -1,8 +0,0 @@
1
- /.*
2
- !/.gitignore
3
- !/.eslintrc.json
4
- !/.github/
5
- /bower_components/
6
- /node_modules/
7
- /output/
8
- package-lock.json
@@ -1,29 +0,0 @@
1
- {
2
- "parserOptions": {
3
- "ecmaVersion": 6,
4
- "sourceType": "module"
5
- },
6
- "extends": "eslint:recommended",
7
- "env": {
8
- "node": true
9
- },
10
- "rules": {
11
- "strict": [2, "global"],
12
- "block-scoped-var": 2,
13
- "consistent-return": 2,
14
- "eqeqeq": [2, "smart"],
15
- "guard-for-in": 2,
16
- "no-caller": 2,
17
- "no-extend-native": 2,
18
- "no-loop-func": 2,
19
- "no-new": 2,
20
- "no-param-reassign": 2,
21
- "no-return-assign": 2,
22
- "no-unused-expressions": 2,
23
- "no-use-before-define": 2,
24
- "radix": [2, "always"],
25
- "indent": [2, 2],
26
- "quotes": [2, "double"],
27
- "semi": [2, "always"]
28
- }
29
- }
@@ -1,8 +0,0 @@
1
- /.*
2
- !/.gitignore
3
- !/.eslintrc.json
4
- !/.github/
5
- /bower_components/
6
- /node_modules/
7
- /output/
8
- package-lock.json
@@ -1,26 +0,0 @@
1
- {
2
- "parserOptions": {
3
- "ecmaVersion": 6,
4
- "sourceType": "module"
5
- },
6
- "extends": "eslint:recommended",
7
- "rules": {
8
- "strict": [2, "global"],
9
- "block-scoped-var": 2,
10
- "consistent-return": 2,
11
- "eqeqeq": [2, "smart"],
12
- "guard-for-in": 2,
13
- "no-caller": 2,
14
- "no-extend-native": 2,
15
- "no-loop-func": 2,
16
- "no-new": 2,
17
- "no-param-reassign": 2,
18
- "no-return-assign": 2,
19
- "no-unused-expressions": 2,
20
- "no-use-before-define": 2,
21
- "radix": [2, "always"],
22
- "indent": [2, 2],
23
- "quotes": [2, "double"],
24
- "semi": [2, "always"]
25
- }
26
- }
@@ -1,8 +0,0 @@
1
- /.*
2
- !/.gitignore
3
- !/.eslintrc.json
4
- !/.github/
5
- /bower_components/
6
- /node_modules/
7
- /output/
8
- package-lock.json
@@ -1,13 +0,0 @@
1
- # https://editorconfig.org
2
- root = true
3
-
4
- [*]
5
- indent_style = space
6
- indent_size = 2
7
- end_of_line = lf
8
- charset = utf-8
9
- trim_trailing_whitespace = true
10
- insert_final_newline = true
11
-
12
- [*.md]
13
- trim_trailing_whitespace = false
@@ -1,9 +0,0 @@
1
- .*
2
- !.gitignore
3
- !.github
4
- !.editorconfig
5
- !.tidyrc.json
6
-
7
- output
8
- generated-docs
9
- bower_components
@@ -1,10 +0,0 @@
1
- {
2
- "importSort": "source",
3
- "importWrap": "source",
4
- "indent": 2,
5
- "operatorsFile": null,
6
- "ribbon": 1,
7
- "typeArrowPlacement": "first",
8
- "unicode": "never",
9
- "width": null
10
- }
@@ -1,8 +0,0 @@
1
- /.*
2
- !/.github
3
- !/.gitignore
4
- !/.npmrc
5
- !/.travis.yml
6
- /bower_components/
7
- /node_modules/
8
- /output/
@@ -1 +0,0 @@
1
- package-lock=false
@@ -1,13 +0,0 @@
1
- # https://editorconfig.org
2
- root = true
3
-
4
- [*]
5
- indent_style = space
6
- indent_size = 2
7
- end_of_line = lf
8
- charset = utf-8
9
- trim_trailing_whitespace = true
10
- insert_final_newline = true
11
-
12
- [*.md]
13
- trim_trailing_whitespace = false
@@ -1,9 +0,0 @@
1
- .*
2
- !.gitignore
3
- !.github
4
- !.editorconfig
5
- !.tidyrc.json
6
-
7
- output
8
- generated-docs
9
- bower_components
@@ -1,10 +0,0 @@
1
- {
2
- "importSort": "source",
3
- "importWrap": "source",
4
- "indent": 2,
5
- "operatorsFile": null,
6
- "ribbon": 1,
7
- "typeArrowPlacement": "first",
8
- "unicode": "never",
9
- "width": null
10
- }
@@ -1,31 +0,0 @@
1
- let zero m n image =
2
- let (m_max, n_max) = dims image
3
- in if (m >= 1) `and` (m <= m_max) `and` (n >= 1) `and` (n <= n_max)
4
- then image!(m, n)
5
- else 0;
6
-
7
- let wrap m n image =
8
- let (m_max, n_max) = dims image
9
- in image!( ((m - 1) `mod` m_max) + 1, ((n - 1) `mod` n_max) + 1);
10
-
11
- let extend m n image =
12
- let (m_max, n_max) = dims image;
13
- m' = min (max m 1) m_max;
14
- n' = min (max n 1) n_max
15
- in image!(m', n');
16
-
17
- let matrixSum matr =
18
- let (m, n) = dims matr
19
- in sum [ matr!(i, j) | (i, j) <- range (1, 1) (m, n)];
20
-
21
- let convolve image kernel lookup =
22
- let ((m, n), (i, j)) = (dims image, dims kernel);
23
- (half_i, half_j) = (i `quot` 2, j `quot` 2);
24
- area = i * j
25
- in [|let interMatrix = [|
26
- let x = m' + i' - 1 - half_i;
27
- y = n' + j' - 1 - half_j
28
- in lookup x y image * kernel!(i', j')
29
- | (i', j') in (i, j) |]
30
- in matrixSum interMatrix `quot` area
31
- | (m', n') in (m, n) |];