@explorable-viz/fluid 0.7.8 → 0.7.10
Sign up to get free protection for your applications and to get access to all the features.
- package/.spago/{argonaut-codecs/v9.0.0 → affjax-node/v1.0.0}/.editorconfig +1 -1
- package/.spago/affjax-node/v1.0.0/.eslintrc.json +30 -0
- package/.spago/affjax-node/v1.0.0/.gitignore +13 -0
- package/.spago/pathy/v9.0.0/.editorconfig +13 -0
- package/dist/fluid/fluid/dataset/methane-emissions.fld +123 -0
- package/dist/fluid/fluid/dataset/mini-non-renewables.fld +3 -0
- package/dist/fluid/fluid/dataset/mini-renewables.fld +6 -0
- package/dist/fluid/fluid/dataset/non-renewables.fld +67 -0
- package/dist/fluid/fluid/dataset/renewables-new.fld +301 -0
- package/dist/fluid/fluid/dataset/renewables-restricted.fld +139 -0
- package/dist/fluid/fluid/dataset/renewables.fld +100 -0
- package/dist/fluid/fluid/example/arithmetic.fld +1 -0
- package/dist/fluid/fluid/example/array.fld +2 -0
- package/dist/fluid/fluid/example/compose.fld +2 -0
- package/dist/fluid/fluid/example/desugar/list-comp-1.fld +1 -0
- package/dist/fluid/fluid/example/desugar/list-comp-10.fld +1 -0
- package/dist/fluid/fluid/example/desugar/list-comp-2.fld +1 -0
- package/dist/fluid/fluid/example/desugar/list-comp-3.fld +1 -0
- package/dist/fluid/fluid/example/desugar/list-comp-4.fld +1 -0
- package/dist/fluid/fluid/example/desugar/list-comp-5.fld +1 -0
- package/dist/fluid/fluid/example/desugar/list-comp-6.fld +1 -0
- package/dist/fluid/fluid/example/desugar/list-comp-7.fld +1 -0
- package/dist/fluid/fluid/example/desugar/list-comp-8.fld +1 -0
- package/dist/fluid/fluid/example/desugar/list-comp-9.fld +1 -0
- package/dist/fluid/fluid/example/desugar/list-enum.fld +1 -0
- package/dist/fluid/fluid/example/dict-list-comp.fld +1 -0
- package/dist/fluid/fluid/example/dicts.fld +10 -0
- package/dist/fluid/fluid/example/div-mod-quot-rem.fld +4 -0
- package/dist/fluid/fluid/example/factorial.fld +6 -0
- package/dist/fluid/fluid/example/filter.fld +1 -0
- package/dist/fluid/fluid/example/first-class-constr.fld +1 -0
- package/dist/fluid/fluid/example/flatten.fld +12 -0
- package/dist/fluid/fluid/example/foldr-sumSquares.fld +1 -0
- package/dist/fluid/fluid/example/graphics/background.fld +7 -0
- package/dist/fluid/fluid/example/graphics/grouped-bar-chart.fld +9 -0
- package/dist/fluid/fluid/example/graphics/line-chart.fld +13 -0
- package/dist/fluid/fluid/example/graphics/stacked-bar-chart.fld +3 -0
- package/dist/fluid/fluid/example/include-input-into-output.fld +1 -0
- package/dist/fluid/fluid/example/length.fld +1 -0
- package/dist/fluid/fluid/example/lexicalScoping.fld +3 -0
- package/dist/fluid/fluid/example/lib/some-constants.fld +1 -0
- package/dist/fluid/fluid/example/linked-inputs/energyscatter.fld +24 -0
- package/dist/fluid/fluid/example/linked-inputs/mini-energyscatter.fld +30 -0
- package/dist/fluid/fluid/example/linked-outputs/convolution-data.fld +5 -0
- package/dist/fluid/fluid/example/linked-outputs/convolution.fld +12 -0
- package/dist/fluid/fluid/example/linked-outputs/line-chart.fld +15 -0
- package/dist/fluid/fluid/example/linked-outputs/moving-average.fld +19 -0
- package/dist/fluid/fluid/example/linked-outputs/pairs-data.fld +1 -0
- package/dist/fluid/fluid/example/linked-outputs/pairs.fld +2 -0
- package/dist/fluid/fluid/example/lookup.fld +15 -0
- package/dist/fluid/fluid/example/map.fld +1 -0
- package/dist/fluid/fluid/example/mergeSort.fld +22 -0
- package/dist/fluid/fluid/example/normalise.fld +3 -0
- package/dist/fluid/fluid/example/nub.fld +1 -0
- package/dist/fluid/fluid/example/pattern-match.fld +12 -0
- package/dist/fluid/fluid/example/percent.fld +1 -0
- package/dist/fluid/fluid/example/plot/methane.fld +14 -0
- package/dist/fluid/fluid/example/plot/non-renewables.fld +22 -0
- package/dist/fluid/fluid/example/range.fld +4 -0
- package/dist/fluid/fluid/example/record-lookup.fld +3 -0
- package/dist/fluid/fluid/example/records.expect.fld +0 -0
- package/dist/fluid/fluid/example/records.fld +11 -0
- package/dist/fluid/fluid/example/reverse.fld +1 -0
- package/dist/fluid/fluid/example/scratchpad.fld +6 -0
- package/dist/fluid/fluid/example/slicing/add.expect.fld +1 -0
- package/dist/fluid/fluid/example/slicing/add.fld +1 -0
- package/dist/fluid/fluid/example/slicing/array/array.expect.fld +2 -0
- package/dist/fluid/fluid/example/slicing/array/array.fld +4 -0
- package/dist/fluid/fluid/example/slicing/array/dims.expect.fld +3 -0
- package/dist/fluid/fluid/example/slicing/array/dims.fld +3 -0
- package/dist/fluid/fluid/example/slicing/array/lookup.expect.fld +3 -0
- package/dist/fluid/fluid/example/slicing/array/lookup.fld +5 -0
- package/dist/fluid/fluid/example/slicing/array/renewables.fld +100 -0
- package/dist/fluid/fluid/example/slicing/convolution/edgeDetect.expect.fld +1 -0
- package/dist/fluid/fluid/example/slicing/convolution/edgeDetect.fld +1 -0
- package/dist/fluid/fluid/example/slicing/convolution/emboss-wrap.fld +1 -0
- package/dist/fluid/fluid/example/slicing/convolution/emboss.expect.fld +1 -0
- package/dist/fluid/fluid/example/slicing/convolution/emboss.fld +1 -0
- package/dist/fluid/fluid/example/slicing/convolution/filter/edge-detect.fld +5 -0
- package/dist/fluid/fluid/example/slicing/convolution/filter/emboss.fld +5 -0
- package/dist/fluid/fluid/example/slicing/convolution/filter/gaussian.fld +5 -0
- package/dist/fluid/fluid/example/slicing/convolution/gaussian.expect.fld +1 -0
- package/dist/fluid/fluid/example/slicing/convolution/gaussian.fld +1 -0
- package/dist/fluid/fluid/example/slicing/convolution/test-image.fld +7 -0
- package/dist/fluid/fluid/example/slicing/dict/create.expect.fld +2 -0
- package/dist/fluid/fluid/example/slicing/dict/create.fld +1 -0
- package/dist/fluid/fluid/example/slicing/dict/difference.expect.fld +4 -0
- package/dist/fluid/fluid/example/slicing/dict/difference.fld +3 -0
- package/dist/fluid/fluid/example/slicing/dict/disjointUnion.expect.fld +2 -0
- package/dist/fluid/fluid/example/slicing/dict/disjointUnion.fld +1 -0
- package/dist/fluid/fluid/example/slicing/dict/foldl.expect.fld +3 -0
- package/dist/fluid/fluid/example/slicing/dict/foldl.fld +1 -0
- package/dist/fluid/fluid/example/slicing/dict/get.expect.fld +5 -0
- package/dist/fluid/fluid/example/slicing/dict/get.fld +3 -0
- package/dist/fluid/fluid/example/slicing/dict/intersectionWith.expect.fld +5 -0
- package/dist/fluid/fluid/example/slicing/dict/intersectionWith.fld +4 -0
- package/dist/fluid/fluid/example/slicing/dict/map.expect.fld +8 -0
- package/dist/fluid/fluid/example/slicing/dict/map.fld +5 -0
- package/dist/fluid/fluid/example/slicing/dict/match.expect.fld +6 -0
- package/dist/fluid/fluid/example/slicing/dict/match.fld +5 -0
- package/dist/fluid/fluid/example/slicing/divide.expect.fld +1 -0
- package/dist/fluid/fluid/example/slicing/divide.fld +1 -0
- package/dist/fluid/fluid/example/slicing/dtw/average-series.expect.fld +8 -0
- package/dist/fluid/fluid/example/slicing/dtw/average-series.fld +8 -0
- package/dist/fluid/fluid/example/slicing/dtw/compute-dtw.expect.fld +6 -0
- package/dist/fluid/fluid/example/slicing/dtw/compute-dtw.fld +6 -0
- package/dist/fluid/fluid/example/slicing/explained.expect.fld +1 -0
- package/dist/fluid/fluid/example/slicing/explained.fld +1 -0
- package/dist/fluid/fluid/example/slicing/filter.expect.fld +4 -0
- package/dist/fluid/fluid/example/slicing/filter.fld +6 -0
- package/dist/fluid/fluid/example/slicing/intersperse-1.expect.fld +4 -0
- package/dist/fluid/fluid/example/slicing/intersperse-2.expect.fld +4 -0
- package/dist/fluid/fluid/example/slicing/intersperse.fld +5 -0
- package/dist/fluid/fluid/example/slicing/length.expect.fld +1 -0
- package/dist/fluid/fluid/example/slicing/length.fld +1 -0
- package/dist/fluid/fluid/example/slicing/linked-outputs/bar-chart-line-chart.expect.fld +0 -0
- package/dist/fluid/fluid/example/slicing/linked-outputs/bar-chart-line-chart.fld +29 -0
- package/dist/fluid/fluid/example/slicing/linked-outputs/stacked-bar-scatter-plot.expect.fld +0 -0
- package/dist/fluid/fluid/example/slicing/linked-outputs/stacked-bar-scatter-plot.fld +39 -0
- package/dist/fluid/fluid/example/slicing/list-comp-1.expect.fld +6 -0
- package/dist/fluid/fluid/example/slicing/list-comp-2.expect.fld +6 -0
- package/dist/fluid/fluid/example/slicing/list-comp.fld +8 -0
- package/dist/fluid/fluid/example/slicing/lookup.expect.fld +6 -0
- package/dist/fluid/fluid/example/slicing/lookup.fld +14 -0
- package/dist/fluid/fluid/example/slicing/map.expect.fld +1 -0
- package/dist/fluid/fluid/example/slicing/map.fld +1 -0
- package/dist/fluid/fluid/example/slicing/matrix-update.expect.fld +5 -0
- package/dist/fluid/fluid/example/slicing/matrix-update.fld +10 -0
- package/dist/fluid/fluid/example/slicing/multiply.expect.fld +1 -0
- package/dist/fluid/fluid/example/slicing/multiply.fld +1 -0
- package/dist/fluid/fluid/example/slicing/nth.expect.fld +1 -0
- package/dist/fluid/fluid/example/slicing/nth.fld +1 -0
- package/dist/fluid/fluid/example/slicing/output-not-source.expect.fld +2 -0
- package/dist/fluid/fluid/example/slicing/output-not-source.fld +1 -0
- package/dist/fluid/fluid/example/slicing/section-5-example-1.expect.fld +10 -0
- package/dist/fluid/fluid/example/slicing/section-5-example-2.expect.fld +10 -0
- package/dist/fluid/fluid/example/slicing/section-5-example-3.expect.fld +10 -0
- package/dist/fluid/fluid/example/slicing/section-5-example.fld +14 -0
- package/dist/fluid/fluid/example/slicing/zeros-1.expect.fld +3 -0
- package/dist/fluid/fluid/example/slicing/zeros-2.expect.fld +3 -0
- package/dist/fluid/fluid/example/slicing/zeros.fld +4 -0
- package/dist/fluid/fluid/example/slicing/zipWith-1.expect.fld +4 -0
- package/dist/fluid/fluid/example/slicing/zipWith.fld +4 -0
- package/dist/fluid/fluid/example/text-viz/explainable-table.fld +7 -0
- package/dist/fluid/fluid/example/text-viz/fake-probabilities.fld +3 -0
- package/dist/fluid/fluid/example/text-viz/figure-spm-4.fld +42 -0
- package/dist/fluid/fluid/example/text-viz/left-barchart-table.fld +5 -0
- package/dist/fluid/fluid/example/text-viz/likelihoods.fld +9 -0
- package/dist/fluid/fluid/example/text-viz/right-barchart-table.fld +5 -0
- package/dist/fluid/fluid/example/text-viz/table-spm-1.fld +30 -0
- package/dist/fluid/fluid/lib/convolution.fld +16 -0
- package/dist/fluid/fluid/lib/dtw.fld +47 -0
- package/dist/fluid/fluid/lib/fnum.fld +22 -0
- package/dist/fluid/fluid/lib/graphics.fld +221 -0
- package/dist/fluid/fluid/lib/prelude.fld +266 -0
- package/dist/fluid/fluid/lib/text-viz.fld +18 -0
- package/dist/fluid/fluid.mjs +28285 -0
- package/package.json +1 -1
- package/.spago/node-process/v11.0.0/.eslintrc.json +0 -29
- package/.spago/node-process/v11.0.0/.gitignore +0 -8
- package/.spago/node-process/v11.1.0/.eslintrc.json +0 -29
- package/.spago/node-process/v11.1.0/.gitignore +0 -8
- package/.spago/node-process/v11.2.0/.eslintrc.json +0 -29
- package/.spago/node-process/v11.2.0/.gitignore +0 -8
- package/.spago/optparse/v6.0.0/.gitignore +0 -8
- package/.spago/optparse/v6.0.0/.npmrc +0 -1
- /package/.spago/{argonaut-codecs → pathy}/v9.0.0/.gitignore +0 -0
- /package/.spago/{argonaut-codecs → pathy}/v9.0.0/.tidyrc.json +0 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
let f {fst: x, snd: []} = x;
|
2
|
+
f {fst: x, snd: (y: xs)} = y;
|
3
|
+
|
4
|
+
g {} = 7
|
5
|
+
in {
|
6
|
+
a: f {snd: [], fst: 2},
|
7
|
+
b: f {fst: 4, snd: [6, 7]},
|
8
|
+
c: g {unused: 22},
|
9
|
+
d: [ x | {fst: x, snd: []} <- [{fst: 5, third: "hello", snd: []}, {fst: 6, snd: [7, 8]}] ],
|
10
|
+
e: {a: 4, h: {i: 6, j: 7}}.h.j
|
11
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
reverse [1, 2]
|
@@ -0,0 +1 @@
|
|
1
|
+
⸨5⸩ + (⸨0⸩ + ⸨3⸩)
|
@@ -0,0 +1 @@
|
|
1
|
+
5 + (0 + 3)
|
@@ -0,0 +1,100 @@
|
|
1
|
+
-- The original dataset sometimes has '~0' instead of '0'.
|
2
|
+
-- Including only 3 countries here. Also, have reduced the Hydro value for China 2015 from 296 to 96 (ouch)
|
3
|
+
-- to make the charts fit nicely into grant proposal. Fix this once proposal submitted!
|
4
|
+
[
|
5
|
+
-- https://www.ren21.net/wp-content/uploads/2019/05/GSR2014_Full-Report_English.pdf
|
6
|
+
{ year: 2013, country: "China", energyType: "Bio", output: 6.2 },
|
7
|
+
{ year: 2013, country: "China", energyType: "Hydro", output: 260 },
|
8
|
+
{ year: 2013, country: "China", energyType: "Solar", output: 19.9 },
|
9
|
+
{ year: 2013, country: "China", energyType: "Wind", output: 91 },
|
10
|
+
|
11
|
+
{ year: 2013, country: "USA", energyType: "Bio", output: 15.8 },
|
12
|
+
{ year: 2013, country: "USA", energyType: "Hydro", output: 78 },
|
13
|
+
{ year: 2013, country: "USA", energyType: "Solar", output: 12.1 },
|
14
|
+
{ year: 2013, country: "USA", energyType: "Wind", output: 61 },
|
15
|
+
|
16
|
+
{ year: 2013, country: "Germany", energyType: "Bio", output: 8.1 },
|
17
|
+
{ year: 2013, country: "Germany", energyType: "Hydro", output: 5.6 },
|
18
|
+
{ year: 2013, country: "Germany", energyType: "Solar", output: 36 },
|
19
|
+
{ year: 2013, country: "Germany", energyType: "Wind", output: 34 },
|
20
|
+
|
21
|
+
-- https://www.ren21.net/wp-content/uploads/2019/05/GSR2015_Full-Report_English.pdf
|
22
|
+
{ year: 2014, country: "China", energyType: "Bio", output: 10 },
|
23
|
+
{ year: 2014, country: "China", energyType: "Hydro", output: 280 },
|
24
|
+
{ year: 2014, country: "China", energyType: "Solar", output: 28 },
|
25
|
+
{ year: 2014, country: "China", energyType: "Wind", output: 115 },
|
26
|
+
|
27
|
+
{ year: 2014, country: "USA", energyType: "Bio", output: 16.1 },
|
28
|
+
{ year: 2014, country: "USA", energyType: "Hydro", output: 79 },
|
29
|
+
{ year: 2014, country: "USA", energyType: "Solar", output: 18 },
|
30
|
+
{ year: 2014, country: "USA", energyType: "Wind", output: 66 },
|
31
|
+
|
32
|
+
{ year: 2014, country: "Germany", energyType: "Bio", output: 8.8 },
|
33
|
+
{ year: 2014, country: "Germany", energyType: "Hydro", output: 5.6 },
|
34
|
+
{ year: 2014, country: "Germany", energyType: "Solar", output: 38 },
|
35
|
+
{ year: 2014, country: "Germany", energyType: "Wind", output: 39 },
|
36
|
+
|
37
|
+
-- https://www.ren21.net/gsr-2016/00-Reference-Tables.php
|
38
|
+
{ year: 2015, country: "China", energyType: "Bio", output: 10.3 },
|
39
|
+
{ year: 2015, country: "China", energyType: "Hydro", output: 96 },
|
40
|
+
{ year: 2015, country: "China", energyType: "Solar", output: 44 },
|
41
|
+
{ year: 2015, country: "China", energyType: "Wind", output: 145 },
|
42
|
+
|
43
|
+
{ year: 2015, country: "USA", energyType: "Bio", output: 16.7 },
|
44
|
+
{ year: 2015, country: "USA", energyType: "Hydro", output: 80 },
|
45
|
+
{ year: 2015, country: "USA", energyType: "Solar", output: 26 },
|
46
|
+
{ year: 2015, country: "USA", energyType: "Wind", output: 74 },
|
47
|
+
|
48
|
+
{ year: 2015, country: "Germany", energyType: "Bio", output: 7.1 },
|
49
|
+
{ year: 2015, country: "Germany", energyType: "Hydro", output: 5.6 },
|
50
|
+
{ year: 2015, country: "Germany", energyType: "Solar", output: 40 },
|
51
|
+
{ year: 2015, country: "Germany", energyType: "Wind", output: 45 },
|
52
|
+
|
53
|
+
-- https://www.ren21.net/gsr-2017/pages/tables/tables/#table-R2
|
54
|
+
{ year: 2016, country: "China", energyType: "Bio", output: 12 },
|
55
|
+
{ year: 2016, country: "China", energyType: "Hydro", output: 305 },
|
56
|
+
{ year: 2016, country: "China", energyType: "Solar", output: 77 },
|
57
|
+
{ year: 2016, country: "China", energyType: "Wind", output: 169 },
|
58
|
+
|
59
|
+
{ year: 2016, country: "USA", energyType: "Bio", output: 16.8 },
|
60
|
+
{ year: 2016, country: "USA", energyType: "Hydro", output: 80 },
|
61
|
+
{ year: 2016, country: "USA", energyType: "Solar", output: 41 },
|
62
|
+
{ year: 2016, country: "USA", energyType: "Wind", output: 82 },
|
63
|
+
|
64
|
+
{ year: 2016, country: "Germany", energyType: "Bio", output: 7.6 },
|
65
|
+
{ year: 2016, country: "Germany", energyType: "Hydro", output: 5.6 },
|
66
|
+
{ year: 2016, country: "Germany", energyType: "Solar", output: 41 },
|
67
|
+
{ year: 2016, country: "Germany", energyType: "Wind", output: 50 },
|
68
|
+
|
69
|
+
-- https://www.ren21.net/gsr-2018/pages/tables/tables/#Table_R2
|
70
|
+
{ year: 2017, country: "China", energyType: "Bio", output: 14.9 },
|
71
|
+
{ year: 2017, country: "China", energyType: "Hydro", output: 313 },
|
72
|
+
{ year: 2017, country: "China", energyType: "Solar", output: 131 },
|
73
|
+
{ year: 2017, country: "China", energyType: "Wind", output: 188},
|
74
|
+
|
75
|
+
{ year: 2017, country: "USA", energyType: "Bio", output: 16.7 },
|
76
|
+
{ year: 2017, country: "USA", energyType: "Hydro", output: 80 },
|
77
|
+
{ year: 2017, country: "USA", energyType: "Solar", output: 51 },
|
78
|
+
{ year: 2017, country: "USA", energyType: "Wind", output: 89 },
|
79
|
+
|
80
|
+
{ year: 2017, country: "Germany", energyType: "Bio", output: 8 },
|
81
|
+
{ year: 2017, country: "Germany", energyType: "Hydro", output: 5.6 },
|
82
|
+
{ year: 2017, country: "Germany", energyType: "Solar", output: 42 },
|
83
|
+
{ year: 2017, country: "Germany", energyType: "Wind", output: 56 },
|
84
|
+
|
85
|
+
-- https://www.ren21.net/gsr-2019/tables/table_02/table_02/
|
86
|
+
{ year: 2018, country: "China", energyType: "Bio", output: 17.8 },
|
87
|
+
{ year: 2018, country: "China", energyType: "Hydro", output: 322 },
|
88
|
+
{ year: 2018, country: "China", energyType: "Solar", output: 176 },
|
89
|
+
{ year: 2018, country: "China", energyType: "Wind", output: 210 },
|
90
|
+
|
91
|
+
{ year: 2018, country: "USA", energyType: "Bio", output: 16.2 },
|
92
|
+
{ year: 2018, country: "USA", energyType: "Hydro", output: 80 },
|
93
|
+
{ year: 2018, country: "USA", energyType: "Solar", output: 62 },
|
94
|
+
{ year: 2018, country: "USA", energyType: "Wind", output: 96 },
|
95
|
+
|
96
|
+
{ year: 2018, country: "Germany", energyType: "Bio", output: 8.4 },
|
97
|
+
{ year: 2018, country: "Germany", energyType: "Hydro", output: 5.6 },
|
98
|
+
{ year: 2018, country: "Germany", energyType: "Solar", output: 45 },
|
99
|
+
{ year: 2018, country: "Germany", energyType: "Wind", output: 59 }
|
100
|
+
]
|
@@ -0,0 +1 @@
|
|
1
|
+
convolve inputImage filter extend
|
@@ -0,0 +1 @@
|
|
1
|
+
convolve inputImage filter extend
|
@@ -0,0 +1 @@
|
|
1
|
+
convolve inputImage filter wrap
|
@@ -0,0 +1 @@
|
|
1
|
+
convolve inputImage filter zero
|
@@ -0,0 +1 @@
|
|
1
|
+
convolve inputImage filter zero
|
@@ -0,0 +1 @@
|
|
1
|
+
convolve inputImage filter zero
|
@@ -0,0 +1 @@
|
|
1
|
+
convolve inputImage filter zero
|
@@ -0,0 +1 @@
|
|
1
|
+
{ ["a"]: 5, ["a" ++ "b"]: 6 }
|
@@ -0,0 +1 @@
|
|
1
|
+
{ a: 5, b: 6 } `dict_disjointUnion` { c: 7 }
|
@@ -0,0 +1 @@
|
|
1
|
+
foldl (*) 1 (dict_foldl concat2 [] { a: [5, 6], b: [0, 10], c: [3, 4] })
|
@@ -0,0 +1 @@
|
|
1
|
+
⸨362⸩ / ⸨9⸩
|
@@ -0,0 +1 @@
|
|
1
|
+
362 / 9
|
@@ -0,0 +1,8 @@
|
|
1
|
+
let d x y = (x - y) * (x - y) in
|
2
|
+
let avg x y = (x + y) / ⸨2⸩ in
|
3
|
+
let avgSeq seq1 seq2 f = map (fun (i, j) = f (nth (i - 1) seq1) (nth (j - 1) seq2)) in
|
4
|
+
let seq1 = [3, ⸨1⸩, 2, 2, 1];
|
5
|
+
seq2 = [2, 0, ⸨0⸩, 3, 3, 1, 0];
|
6
|
+
window = 2;
|
7
|
+
(costs, matched) = computeDTW seq1 seq2 d window in
|
8
|
+
avgSeq seq1 seq2 avg matched
|
@@ -0,0 +1,8 @@
|
|
1
|
+
let d x y = (x - y) * (x - y);
|
2
|
+
let avg x y = (x + y) / 2;
|
3
|
+
let avgSeq seq1 seq2 f = map (fun (i, j) -> f (nth (i - 1) seq1) (nth (j - 1) seq2));
|
4
|
+
let seq1 = [3,1,2,2,1];
|
5
|
+
seq2 = [2,0,0,3,3,1,0];
|
6
|
+
window = 2;
|
7
|
+
(costs, matched) = computeDTW seq1 seq2 d window
|
8
|
+
in avgSeq seq1 seq2 avg matched
|
@@ -0,0 +1 @@
|
|
1
|
+
@ (1 + 1) @
|
@@ -0,0 +1 @@
|
|
1
|
+
@ (1 + 1) @
|
@@ -0,0 +1 @@
|
|
1
|
+
length ⸨[⸩ 1 ⸨,⸩ 2 ⸨,⸩ 3 ⸨,⸩ 4 ⸨,⸩ 5 ⸨]⸩
|
@@ -0,0 +1 @@
|
|
1
|
+
length [1, 2, 3, 4, 5]
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
MultiView {
|
2
|
+
barChart:
|
3
|
+
let totalFor c rows =
|
4
|
+
sum [ row.output | row <- rows, row.country == c ];
|
5
|
+
let data2015 = [ row | row <- renewables, row.year == 2015 ];
|
6
|
+
countryData = [ { x: c, bars: [ { y: "output", z: totalFor c data2015 } ] }
|
7
|
+
| c <- ["China", "USA", "Germany"] ]
|
8
|
+
in BarChart {
|
9
|
+
caption: "Total output by country",
|
10
|
+
size: { width: 275, height: 185 },
|
11
|
+
stackedBars: countryData
|
12
|
+
},
|
13
|
+
lineChart:
|
14
|
+
let series type country = [
|
15
|
+
{ x: row.year, y: row.output }
|
16
|
+
| year <- [2013..2018], row <- renewables,
|
17
|
+
row.year == year, row.energyType == type, row.country == country
|
18
|
+
] in LineChart {
|
19
|
+
tickLabels: { x: Default, y: Default },
|
20
|
+
size: { width: 330, height: 285 },
|
21
|
+
caption: "Output of USA relative to China",
|
22
|
+
plots: [
|
23
|
+
LinePlot { name: type, points: plot }
|
24
|
+
| type <- ["Bio", "Hydro", "Solar", "Wind"],
|
25
|
+
let plot = zipWith (fun p1 p2 -> { x: p1.x, y: p1.y / p2.y })
|
26
|
+
(series type "USA") (series type "China")
|
27
|
+
]
|
28
|
+
}
|
29
|
+
}
|
File without changes
|
@@ -0,0 +1,39 @@
|
|
1
|
+
MultiView {
|
2
|
+
stackedBarChart:
|
3
|
+
let totalFor year country rows =
|
4
|
+
let [ row ] = [ row | row <- rows, row.year == year, row.country == country ]
|
5
|
+
in row.nuclearOut + row.gasOut + row.coalOut + row.petrolOut;
|
6
|
+
let stack year = [ { y: country, z: totalFor year country nonRenewables }
|
7
|
+
| country <- ["BRA", "EGY", "IND", "JPN"] ]
|
8
|
+
in BarChart {
|
9
|
+
caption: "Non-renewables by country",
|
10
|
+
size: { width: 275, height: 185 },
|
11
|
+
stackedBars: [ { x: numToStr year, bars: stack year }
|
12
|
+
| year <- [2014..2018] ]
|
13
|
+
},
|
14
|
+
scatterPlot:
|
15
|
+
let isCountry name x = name == x.country;
|
16
|
+
isYear year x = year == x.year;
|
17
|
+
|
18
|
+
let plot year countries =
|
19
|
+
let rens = filter (isYear year) renewables;
|
20
|
+
nonRens = filter (isYear year) nonRenewables;
|
21
|
+
let plotCountry country =
|
22
|
+
let rens' = filter (isCountry country) rens;
|
23
|
+
rensOut = sum (map (fun x -> x.output) rens');
|
24
|
+
rensCap = sum (map (fun x -> x.capacity) rens');
|
25
|
+
x = head (filter (isCountry country) nonRens);
|
26
|
+
nonRensCap = x.nuclearCap + x.petrolCap + x.gasCap + x.coalCap
|
27
|
+
in {
|
28
|
+
x: rensCap / (rensCap + nonRensCap),
|
29
|
+
y: (rensOut + x.nuclearOut) / (rensCap + x.nuclearCap)
|
30
|
+
}
|
31
|
+
in map plotCountry countries
|
32
|
+
|
33
|
+
in ScatterPlot {
|
34
|
+
caption: "Clean energy efficiency vs proportion of renewable energy capacity",
|
35
|
+
points: plot 2018 [ "BRA", "CHN", "DEU", "FRA", "EGY", "IND", "JPN", "MEX", "NGA", "USA" ],
|
36
|
+
xlabel: "Renewables/TotalEnergyCap",
|
37
|
+
ylabel: "Clean Capacity Factor"
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
let data = [{year : 2013, country : "China", energyType : "Bio", output : 6.2}
|
2
|
+
, {year : 2013, country : "China", energyType : ⸨"Hydro"⸩, output : 260}
|
3
|
+
, {year : 2013, country : "China", energyType : "Solar", output : 19.9}
|
4
|
+
, {year : 2013, country : "China", energyType : "Wind", output : 91}
|
5
|
+
] in
|
6
|
+
⸨[row.output|type <- ["Bio", ⸨"Hydro"⸩, "Solar", "Wind"], row <- data, row.energyType == type]⸩
|
@@ -0,0 +1,6 @@
|
|
1
|
+
let data = [{year : 2013, country : "China", energyType : "Bio", output : 6.2}
|
2
|
+
, {year : 2013, country : "China", energyType : "Hydro", output : 260}
|
3
|
+
, {year : 2013, country : "China", energyType : ⸨"Solar"⸩, output : 19.9}
|
4
|
+
, {year : 2013, country : "China", energyType : "Wind", output : 91}
|
5
|
+
] in
|
6
|
+
⸨[row.output|type <- ["Bio", "Hydro", ⸨"Solar"⸩, "Wind"], row <- data, row.energyType == type]⸩
|
@@ -0,0 +1,8 @@
|
|
1
|
+
let data = [
|
2
|
+
{ year: 2013, country: "China", energyType: "Bio", output: 6.2 },
|
3
|
+
{ year: 2013, country: "China", energyType: "Hydro", output: 260 },
|
4
|
+
{ year: 2013, country: "China", energyType: "Solar", output: 19.9 },
|
5
|
+
{ year: 2013, country: "China", energyType: "Wind", output: 91 }
|
6
|
+
] in
|
7
|
+
[ row.output | type <- ["Bio", "Hydro", "Solar", "Wind"],
|
8
|
+
row <- data, row.energyType == type ]
|
@@ -0,0 +1,6 @@
|
|
1
|
+
let lookup k (Empty) = None;
|
2
|
+
lookup k (NonEmpty t1 (key, val) t2) = match compare k key as
|
3
|
+
{(LT) -> lookup k t1;
|
4
|
+
(EQ) -> ⸨Some val⸩;
|
5
|
+
(GT) -> lookup k t2} in
|
6
|
+
lookup ⸨6⸩ (NonEmpty (NonEmpty (Empty) ((3, "USA")) (Empty)) ((4, "China")) (NonEmpty (⸨NonEmpty (Empty) (⸨(⸨6⸩, "Germany")⸩) (Empty)⸩) ((7, "UK")) (Empty)))
|
@@ -0,0 +1,14 @@
|
|
1
|
+
let lookup k Empty = None;
|
2
|
+
lookup k (NonEmpty t1 (key, val) t2) =
|
3
|
+
match compare k key as {
|
4
|
+
LT -> lookup k t1;
|
5
|
+
EQ -> Some val;
|
6
|
+
GT -> lookup k t2
|
7
|
+
}
|
8
|
+
in
|
9
|
+
lookup 6
|
10
|
+
(NonEmpty
|
11
|
+
(NonEmpty Empty (3, "USA") Empty)
|
12
|
+
(4, "China")
|
13
|
+
(NonEmpty (NonEmpty Empty (6, "Germany") Empty) (7, "UK") Empty)
|
14
|
+
)
|
@@ -0,0 +1 @@
|
|
1
|
+
map ((+) 2) ⸨[⸩ 3 ⸨,⸩ 4]
|
@@ -0,0 +1 @@
|
|
1
|
+
map ((+) 2) [3, 4]
|
@@ -0,0 +1 @@
|
|
1
|
+
5 * (⸨0⸩ * 3)
|
@@ -0,0 +1 @@
|
|
1
|
+
5 * (0 * 3)
|
@@ -0,0 +1 @@
|
|
1
|
+
nth 1 [3, ⸨4⸩, 5]
|
@@ -0,0 +1 @@
|
|
1
|
+
nth 1 [3, 4, 5]
|
@@ -0,0 +1 @@
|
|
1
|
+
let x = 3 in (x, x < 5)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
let map f [] = [];
|
2
|
+
map f (x : xs) = ⸨(f x : map f xs)⸩ in
|
3
|
+
let data = [{energyType : "Bio", output : 6.2}
|
4
|
+
, {energyType : ⸨"Hydro"⸩, output : 260}
|
5
|
+
, {energyType : "Solar", output : 19.9}
|
6
|
+
, {energyType : "Wind", output : 91}
|
7
|
+
, {energyType : "Geo", output : 14.4}
|
8
|
+
];
|
9
|
+
output = ⸨[row.output|type <- [⸨"Hydro"⸩, "Solar", "Geo"], row <- data, row.energyType == type]⸩ in
|
10
|
+
map (fun x = floor ((x / sum output) * 100)) output
|
@@ -0,0 +1,10 @@
|
|
1
|
+
let map f [] = [];
|
2
|
+
map f (x : xs) = (f x : map f xs) in
|
3
|
+
let data = [{energyType : "Bio", output : 6.2}
|
4
|
+
, {energyType : "Hydro", output : ⸨260⸩}
|
5
|
+
, {energyType : "Solar", output : ⸨19.9⸩}
|
6
|
+
, {energyType : "Wind", output : 91}
|
7
|
+
, {energyType : "Geo", output : ⸨14.4⸩}
|
8
|
+
];
|
9
|
+
output = [row.output|type <- ["Hydro", "Solar", "Geo"], row <- data, row.energyType == type] in
|
10
|
+
map (fun x = floor ((x / sum output) * ⸨100⸩)) output
|
@@ -0,0 +1,10 @@
|
|
1
|
+
let map f [] = [];
|
2
|
+
map f (x : xs) = ⸨(f x : map f xs)⸩ in
|
3
|
+
let data = [{energyType : "Bio", output : 6.2}
|
4
|
+
, {energyType : "Hydro", output : 260}
|
5
|
+
, {energyType : "Solar", output : 19.9}
|
6
|
+
, {energyType : "Wind", output : 91}
|
7
|
+
, {energyType : ⸨"Geo"⸩, output : 14.4}
|
8
|
+
];
|
9
|
+
output = ⸨[row.output|type <- ["Hydro", "Solar", ⸨"Geo"⸩], row <- data, row.energyType == type]⸩ in
|
10
|
+
map (fun x = floor ((x / sum output) * 100)) output
|