@explorable-viz/fluid 0.7.64 → 0.7.66

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. package/dist/fluid/fluid/lib/graphics.fld +6 -6
  2. package/dist/fluid/shared/fluid.mjs +4 -3
  3. package/dist/fluid/shared/load-figure.js +338 -168
  4. package/package.json +3 -2
  5. package/script/bundle-website.sh +4 -1
  6. package/dist/fluid/fluid/dataset/methane-emissions.fld +0 -123
  7. package/dist/fluid/fluid/dataset/mini-non-renewables.fld +0 -3
  8. package/dist/fluid/fluid/dataset/mini-renewables.fld +0 -6
  9. package/dist/fluid/fluid/dataset/non-renewables.fld +0 -67
  10. package/dist/fluid/fluid/dataset/renewables-new.fld +0 -301
  11. package/dist/fluid/fluid/dataset/renewables-restricted.fld +0 -139
  12. package/dist/fluid/fluid/dataset/renewables.fld +0 -100
  13. package/dist/fluid/fluid/dataset/ssp126-2081-2100.fld +0 -194
  14. package/dist/fluid/fluid/example/arithmetic.fld +0 -1
  15. package/dist/fluid/fluid/example/array.fld +0 -2
  16. package/dist/fluid/fluid/example/compose.fld +0 -2
  17. package/dist/fluid/fluid/example/desugar/list-comp-1.fld +0 -1
  18. package/dist/fluid/fluid/example/desugar/list-comp-10.fld +0 -1
  19. package/dist/fluid/fluid/example/desugar/list-comp-2.fld +0 -1
  20. package/dist/fluid/fluid/example/desugar/list-comp-3.fld +0 -1
  21. package/dist/fluid/fluid/example/desugar/list-comp-4.fld +0 -1
  22. package/dist/fluid/fluid/example/desugar/list-comp-5.fld +0 -1
  23. package/dist/fluid/fluid/example/desugar/list-comp-6.fld +0 -1
  24. package/dist/fluid/fluid/example/desugar/list-comp-7.fld +0 -1
  25. package/dist/fluid/fluid/example/desugar/list-comp-8.fld +0 -1
  26. package/dist/fluid/fluid/example/desugar/list-comp-9.fld +0 -1
  27. package/dist/fluid/fluid/example/desugar/list-enum.fld +0 -1
  28. package/dist/fluid/fluid/example/dict-list-comp.fld +0 -1
  29. package/dist/fluid/fluid/example/dicts.fld +0 -10
  30. package/dist/fluid/fluid/example/div-mod-quot-rem.fld +0 -4
  31. package/dist/fluid/fluid/example/factorial.fld +0 -6
  32. package/dist/fluid/fluid/example/filter.fld +0 -1
  33. package/dist/fluid/fluid/example/first-class-constr.fld +0 -1
  34. package/dist/fluid/fluid/example/flatten.fld +0 -12
  35. package/dist/fluid/fluid/example/foldr-sumSquares.fld +0 -1
  36. package/dist/fluid/fluid/example/graphics/background.fld +0 -7
  37. package/dist/fluid/fluid/example/graphics/grouped-bar-chart.fld +0 -9
  38. package/dist/fluid/fluid/example/graphics/line-chart.fld +0 -13
  39. package/dist/fluid/fluid/example/graphics/stacked-bar-chart.fld +0 -3
  40. package/dist/fluid/fluid/example/include-input-into-output.fld +0 -1
  41. package/dist/fluid/fluid/example/length.fld +0 -1
  42. package/dist/fluid/fluid/example/lexicalScoping.fld +0 -3
  43. package/dist/fluid/fluid/example/lib/some-constants.fld +0 -1
  44. package/dist/fluid/fluid/example/linked-inputs/energyscatter.fld +0 -23
  45. package/dist/fluid/fluid/example/linked-inputs/mini-energyscatter.fld +0 -29
  46. package/dist/fluid/fluid/example/linked-outputs/convolution-data.fld +0 -5
  47. package/dist/fluid/fluid/example/linked-outputs/convolution.fld +0 -12
  48. package/dist/fluid/fluid/example/linked-outputs/line-chart.fld +0 -15
  49. package/dist/fluid/fluid/example/linked-outputs/moving-average.fld +0 -19
  50. package/dist/fluid/fluid/example/linked-outputs/pairs-data.fld +0 -1
  51. package/dist/fluid/fluid/example/lookup.fld +0 -15
  52. package/dist/fluid/fluid/example/map.fld +0 -1
  53. package/dist/fluid/fluid/example/mergeSort.fld +0 -22
  54. package/dist/fluid/fluid/example/normalise.fld +0 -3
  55. package/dist/fluid/fluid/example/nub.fld +0 -1
  56. package/dist/fluid/fluid/example/pattern-match.fld +0 -12
  57. package/dist/fluid/fluid/example/percent.fld +0 -1
  58. package/dist/fluid/fluid/example/plot/methane.fld +0 -14
  59. package/dist/fluid/fluid/example/plot/non-renewables.fld +0 -21
  60. package/dist/fluid/fluid/example/range.fld +0 -4
  61. package/dist/fluid/fluid/example/record-lookup.fld +0 -3
  62. package/dist/fluid/fluid/example/records.expect.fld +0 -0
  63. package/dist/fluid/fluid/example/records.fld +0 -11
  64. package/dist/fluid/fluid/example/reverse.fld +0 -1
  65. package/dist/fluid/fluid/example/scratchpad.fld +0 -6
  66. package/dist/fluid/fluid/example/slicing/add.expect.fld +0 -1
  67. package/dist/fluid/fluid/example/slicing/add.fld +0 -1
  68. package/dist/fluid/fluid/example/slicing/array/array.expect.fld +0 -2
  69. package/dist/fluid/fluid/example/slicing/array/array.fld +0 -4
  70. package/dist/fluid/fluid/example/slicing/array/dims.expect.fld +0 -3
  71. package/dist/fluid/fluid/example/slicing/array/dims.fld +0 -3
  72. package/dist/fluid/fluid/example/slicing/array/lookup.expect.fld +0 -3
  73. package/dist/fluid/fluid/example/slicing/array/lookup.fld +0 -5
  74. package/dist/fluid/fluid/example/slicing/array/renewables.fld +0 -100
  75. package/dist/fluid/fluid/example/slicing/convolution/edgeDetect.expect.fld +0 -1
  76. package/dist/fluid/fluid/example/slicing/convolution/edgeDetect.fld +0 -1
  77. package/dist/fluid/fluid/example/slicing/convolution/emboss-wrap.fld +0 -1
  78. package/dist/fluid/fluid/example/slicing/convolution/emboss.expect.fld +0 -1
  79. package/dist/fluid/fluid/example/slicing/convolution/emboss.fld +0 -1
  80. package/dist/fluid/fluid/example/slicing/convolution/filter/edge-detect.fld +0 -5
  81. package/dist/fluid/fluid/example/slicing/convolution/filter/emboss.fld +0 -5
  82. package/dist/fluid/fluid/example/slicing/convolution/filter/gaussian.fld +0 -5
  83. package/dist/fluid/fluid/example/slicing/convolution/gaussian.expect.fld +0 -1
  84. package/dist/fluid/fluid/example/slicing/convolution/gaussian.fld +0 -1
  85. package/dist/fluid/fluid/example/slicing/convolution/test-image.fld +0 -7
  86. package/dist/fluid/fluid/example/slicing/dict/create.expect.fld +0 -2
  87. package/dist/fluid/fluid/example/slicing/dict/create.fld +0 -1
  88. package/dist/fluid/fluid/example/slicing/dict/difference.expect.fld +0 -4
  89. package/dist/fluid/fluid/example/slicing/dict/difference.fld +0 -3
  90. package/dist/fluid/fluid/example/slicing/dict/disjointUnion.expect.fld +0 -2
  91. package/dist/fluid/fluid/example/slicing/dict/disjointUnion.fld +0 -1
  92. package/dist/fluid/fluid/example/slicing/dict/foldl.expect.fld +0 -3
  93. package/dist/fluid/fluid/example/slicing/dict/foldl.fld +0 -1
  94. package/dist/fluid/fluid/example/slicing/dict/get.expect.fld +0 -5
  95. package/dist/fluid/fluid/example/slicing/dict/get.fld +0 -3
  96. package/dist/fluid/fluid/example/slicing/dict/intersectionWith.expect.fld +0 -5
  97. package/dist/fluid/fluid/example/slicing/dict/intersectionWith.fld +0 -4
  98. package/dist/fluid/fluid/example/slicing/dict/map.expect.fld +0 -8
  99. package/dist/fluid/fluid/example/slicing/dict/map.fld +0 -5
  100. package/dist/fluid/fluid/example/slicing/dict/match.expect.fld +0 -6
  101. package/dist/fluid/fluid/example/slicing/dict/match.fld +0 -5
  102. package/dist/fluid/fluid/example/slicing/divide.expect.fld +0 -1
  103. package/dist/fluid/fluid/example/slicing/divide.fld +0 -1
  104. package/dist/fluid/fluid/example/slicing/dtw/average-series.expect.fld +0 -8
  105. package/dist/fluid/fluid/example/slicing/dtw/average-series.fld +0 -8
  106. package/dist/fluid/fluid/example/slicing/dtw/compute-dtw.expect.fld +0 -6
  107. package/dist/fluid/fluid/example/slicing/dtw/compute-dtw.fld +0 -6
  108. package/dist/fluid/fluid/example/slicing/explained.expect.fld +0 -1
  109. package/dist/fluid/fluid/example/slicing/explained.fld +0 -1
  110. package/dist/fluid/fluid/example/slicing/filter.expect.fld +0 -4
  111. package/dist/fluid/fluid/example/slicing/filter.fld +0 -6
  112. package/dist/fluid/fluid/example/slicing/intersperse-1.expect.fld +0 -4
  113. package/dist/fluid/fluid/example/slicing/intersperse-2.expect.fld +0 -4
  114. package/dist/fluid/fluid/example/slicing/intersperse.fld +0 -5
  115. package/dist/fluid/fluid/example/slicing/length.expect.fld +0 -1
  116. package/dist/fluid/fluid/example/slicing/length.fld +0 -1
  117. package/dist/fluid/fluid/example/slicing/linked-outputs/bar-chart-line-chart.expect.fld +0 -0
  118. package/dist/fluid/fluid/example/slicing/linked-outputs/bar-chart-line-chart.fld +0 -29
  119. package/dist/fluid/fluid/example/slicing/linked-outputs/stacked-bar-scatter-plot.expect.fld +0 -0
  120. package/dist/fluid/fluid/example/slicing/linked-outputs/stacked-bar-scatter-plot.fld +0 -38
  121. package/dist/fluid/fluid/example/slicing/list-comp-1.expect.fld +0 -6
  122. package/dist/fluid/fluid/example/slicing/list-comp-2.expect.fld +0 -6
  123. package/dist/fluid/fluid/example/slicing/list-comp.fld +0 -8
  124. package/dist/fluid/fluid/example/slicing/lookup.expect.fld +0 -6
  125. package/dist/fluid/fluid/example/slicing/lookup.fld +0 -14
  126. package/dist/fluid/fluid/example/slicing/map.expect.fld +0 -1
  127. package/dist/fluid/fluid/example/slicing/map.fld +0 -1
  128. package/dist/fluid/fluid/example/slicing/matrix-update.expect.fld +0 -5
  129. package/dist/fluid/fluid/example/slicing/matrix-update.fld +0 -10
  130. package/dist/fluid/fluid/example/slicing/multiply.expect.fld +0 -1
  131. package/dist/fluid/fluid/example/slicing/multiply.fld +0 -1
  132. package/dist/fluid/fluid/example/slicing/nth.expect.fld +0 -1
  133. package/dist/fluid/fluid/example/slicing/nth.fld +0 -1
  134. package/dist/fluid/fluid/example/slicing/output-not-source.expect.fld +0 -2
  135. package/dist/fluid/fluid/example/slicing/output-not-source.fld +0 -1
  136. package/dist/fluid/fluid/example/slicing/qcut.expect.fld +0 -0
  137. package/dist/fluid/fluid/example/slicing/qcut.fld +0 -2
  138. package/dist/fluid/fluid/example/slicing/section-5-example-1.expect.fld +0 -10
  139. package/dist/fluid/fluid/example/slicing/section-5-example-2.expect.fld +0 -10
  140. package/dist/fluid/fluid/example/slicing/section-5-example-3.expect.fld +0 -10
  141. package/dist/fluid/fluid/example/slicing/section-5-example.fld +0 -14
  142. package/dist/fluid/fluid/example/slicing/zeros-1.expect.fld +0 -3
  143. package/dist/fluid/fluid/example/slicing/zeros-2.expect.fld +0 -3
  144. package/dist/fluid/fluid/example/slicing/zeros.fld +0 -4
  145. package/dist/fluid/fluid/example/slicing/zipWith-1.expect.fld +0 -4
  146. package/dist/fluid/fluid/example/slicing/zipWith.fld +0 -4
  147. package/dist/fluid/fluid/example/text-viz/datasets/ssp126.fld +0 -898
  148. package/dist/fluid/fluid/example/text-viz/datasets/ssp245.fld +0 -954
  149. package/dist/fluid/fluid/example/text-viz/datasets/ssp370.fld +0 -842
  150. package/dist/fluid/fluid/example/text-viz/datasets/ssp585.fld +0 -954
  151. package/dist/fluid/fluid/example/text-viz/explainable-table.fld +0 -7
  152. package/dist/fluid/fluid/example/text-viz/fake-probabilities.fld +0 -3
  153. package/dist/fluid/fluid/example/text-viz/figure-spm-4.fld +0 -42
  154. package/dist/fluid/fluid/example/text-viz/left-barchart-table.fld +0 -5
  155. package/dist/fluid/fluid/example/text-viz/likelihoods.fld +0 -9
  156. package/dist/fluid/fluid/example/text-viz/right-barchart-table.fld +0 -5
  157. package/dist/fluid/fluid/example/text-viz/table-spm-1.fld +0 -30
@@ -1,15 +0,0 @@
1
- let series type country = [
2
- { x: row.year, y: row.output }
3
- | year <- [2013..2018], row <- renewables,
4
- row.year == year, row.energyType == type, row.country == country
5
- ] in LineChart {
6
- tickLabels: { x: Default, y: Default },
7
- caption: "Change in renewable energy output of USA relative to China",
8
- size: { width: 330, height: 285 },
9
- plots: [
10
- LinePlot { name: type, points: plot }
11
- | type <- ["Bio", "Hydro", "Solar", "Wind"],
12
- let plot = zipWith (fun p1 p2 -> { x: p1.x, y: p1.y / p2.y })
13
- (series type "USA") (series type "China")
14
- ]
15
- }
@@ -1,19 +0,0 @@
1
- let nthPad n xs =
2
- nth (min (max n 0) (length xs - 1)) xs;
3
- movingAvg ys window =
4
- [ sum [ nthPad n ys | n <- [ i - window .. i + window ] ] / (1 + 2 * window)
5
- | i <- [ 0 .. length ys - 1 ] ];
6
- movingAvg' rs window =
7
- zipWith
8
- (fun x y -> {x: x, y: y})
9
- (map (fun r -> r.x) rs)
10
- (movingAvg (map (fun r -> r.y) rs) window);
11
- let points =
12
- [ { x: r.year, y: r.emissions } | r <- methane, r.type == "Agriculture" ]
13
- in LineChart {
14
- tickLabels: { x: Rotated, y: Default },
15
- size: { width: 330, height: 285 },
16
- caption: "SSP5-8.5 projected methane emissions (Agriculture)",
17
- plots: [ LinePlot { name: "Moving average", points: movingAvg' points 1 },
18
- LinePlot { name: "Original curve", points: points } ]
19
- }
@@ -1,15 +0,0 @@
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
10
- 6
11
- (NonEmpty
12
- (NonEmpty Empty (3, "simon") Empty)
13
- (4, "john")
14
- (NonEmpty (NonEmpty Empty (6, "sarah") Empty) (7, "claire") Empty)
15
- )
@@ -1 +0,0 @@
1
- map ((+) 1) [4, 6, 12, 14, 3, 2, -4]
@@ -1,22 +0,0 @@
1
- let split [] = ([], []);
2
- split (x : xs) =
3
- let (ys, zs) = split xs in (x : zs, ys);
4
-
5
- merge xs ys =
6
- match (xs, ys) as {
7
- ([], _) -> ys;
8
- (x : xs', []) -> xs;
9
- (x : xs', y : ys') ->
10
- if x < y
11
- then x : merge xs' ys
12
- else y : merge xs ys'
13
- };
14
-
15
- mergesort xs =
16
- if length xs < 2
17
- then xs
18
- else
19
- let (ys, zs) = split xs in
20
- merge (mergesort ys) (mergesort zs)
21
- in
22
- mergesort [3, 1, 2]
@@ -1,3 +0,0 @@
1
- let (x, y) = (6.0, 12.0);
2
- sum = x + y in
3
- (floor (x * 100.0 / sum), floor (y * 100 / sum))
@@ -1 +0,0 @@
1
- nub [1, 2, 3, 3, 4]
@@ -1,12 +0,0 @@
1
- -- Silly test of pattern-matching for list notation
2
- let
3
- zip3 [] [] = [];
4
- zip3 [x1] [y1] = (x1, y1) : zip3 [] [];
5
- zip3 [x1, x2] [y1, y2] =
6
- (x1, y1) : zip3 [x2] [y2];
7
- zip3 [x1, x2, x3] [y1, y2, y3] =
8
- (x1 , y1) : zip3 [x2, x3] [y2, y3];
9
- zip3 (x1 : x2 : x3 : x4 : xs) (y1 : y2 : y3 : y4 : ys) =
10
- (x1, y1) : (x2, y2) : (x3, y3) : (x4, y4) : zip3 xs ys
11
- in
12
- length (zip3 [3, 4, 5, 6] [5, 6, 7, 8])
@@ -1 +0,0 @@
1
- mkPercent 0.25
@@ -1,14 +0,0 @@
1
- let series type = [
2
- { x: row.year, y: row.emissions }
3
- | row <- methane, row.type == type
4
- ] in LineChart {
5
- size: { width: 450, height: 285 },
6
- tickLabels: { x: Rotated, y: Default },
7
- caption: "Sources of methane emissions for Africa and the Middle East (IPCC AR6)",
8
- plots: [
9
- LinePlot { name: type, points: series type }
10
- | type <- ["Agricultural Waste Burning", "Agriculture", "Energy Sector",
11
- "Forest Burning", "Grassland Burning", "Industrial Sector",
12
- "Residential Commercial Other", "Transportation Sector", "Waste"]
13
- ]
14
- }
@@ -1,21 +0,0 @@
1
- let countries = ["BRA", "EGY", "IND", "JPN"];
2
- let totalFor year country =
3
- let [ row ] = [ row | row <- nonRenewables, row.year == year, row.country == country ]
4
- in row.nuclearOut + row.gasOut + row.coalOut + row.petrolOut;
5
- let stack year = [ { y: country, z: totalFor year country } | country <- countries ];
6
- let yearData year = [ row | row <- nonRenewables, row.year == year, row.country `elem` countries ]
7
- in MultiView {
8
- barChart: BarChart {
9
- caption: "Non-renewables output",
10
- size: { width: 275, height: 185 },
11
- stackedBars: [ { x: numToStr year, bars: stack year } | year <- [2014..2018] ]
12
- },
13
- scatterPlot: ScatterPlot {
14
- caption: "",
15
- points: [ {
16
- x: sum [ row.nuclearOut | row <- yearData year ],
17
- y: sum [ row.nuclearCap | row <- yearData year ]
18
- } | year <- [2014..2018] ],
19
- labels: { x: "Nuclear capacity", y: "Nuclear output" }
20
- }
21
- }
@@ -1,4 +0,0 @@
1
- let range1 (m, n) = [m..n];
2
- range2 ((m1, n1), (m2, n2)) =
3
- [ (i1, i2) | i1 <- range1 (m1, m2), i2 <- range1 (n1, n2)]
4
- in range2 ((0, 0), (1, 1))
@@ -1,3 +0,0 @@
1
- let city = { name: "Germany" };
2
- country = { cities: [ "Germany" ] }
3
- in city.name `elem` country.cities
File without changes
@@ -1,11 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- reverse [1, 2]
@@ -1,6 +0,0 @@
1
- let nth2 i j xs = nth (i - 1) (nth (j - 1) xs) in
2
- let xs = [[1, 4, 8],
3
- [3, 2, 17],
4
- [0, 14, 6]];
5
- ys = [| nth2 i j xs | (i, j) in (3, 3) |]
6
- in ys ! (3, 2)
@@ -1 +0,0 @@
1
- ⸨5⸩ + (⸨0⸩ + ⸨3⸩)
@@ -1 +0,0 @@
1
- 5 + (0 + 3)
@@ -1,2 +0,0 @@
1
- let xs = [[1, 4, 8], [3, _2_, 17], [0, 14, 6]]
2
- in [| nth2 i j xs | (i, j) in (3, 3) |]
@@ -1,4 +0,0 @@
1
- let xs = [[1, 4, 8],
2
- [3, 2, 17],
3
- [0, 14, 6]]
4
- in [| nth2 i j xs | (i, j) in (3, 3) |]
@@ -1,3 +0,0 @@
1
- let (x, y) = ⸨(⸨3⸩, ⸨3⸩)⸩;
2
- yss = ⸨[|0|(i, j) in (x, y)|]⸩ in
3
- dims yss
@@ -1,3 +0,0 @@
1
- let (x, y) = (3, 3);
2
- yss = [| 0 | (i, j) in (x, y) |]
3
- in dims yss
@@ -1,3 +0,0 @@
1
- let xs = [[1, 4, 8], [3, 2, 17], [0, ⸨14⸩, 6]];
2
- ys = [|nth2 i j xs|(i, j) in (3, 3)|] in
3
- ys ! ((3, 2))
@@ -1,5 +0,0 @@
1
- let xs = [[1, 4, 8],
2
- [3, 2, 17],
3
- [0, 14, 6]];
4
- ys = [| nth2 i j xs | (i, j) in (3, 3) |]
5
- in ys ! (3, 2)
@@ -1,100 +0,0 @@
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
- ]
@@ -1 +0,0 @@
1
- convolve inputImage filter extend
@@ -1 +0,0 @@
1
- convolve inputImage filter extend
@@ -1 +0,0 @@
1
- convolve inputImage filter wrap
@@ -1 +0,0 @@
1
- convolve inputImage filter zero
@@ -1 +0,0 @@
1
- convolve inputImage filter zero
@@ -1,5 +0,0 @@
1
- let filter =
2
- let edgeDetect = [[0, 1, 0],
3
- [1, -4, 1],
4
- [0, 1, 0]] in
5
- [| nth2 i j edgeDetect | (i, j) in (3, 3) |];
@@ -1,5 +0,0 @@
1
- let filter =
2
- let emboss = [[-2, -1, 0],
3
- [-1, 1, 1],
4
- [ 0, 1, 2]] in
5
- [| nth2 i j emboss | (i, j) in (3, 3) |];
@@ -1,5 +0,0 @@
1
- let filter =
2
- let gaussian = [[1, 4, 1],
3
- [4, 16, 4],
4
- [1, 4, 1]] in
5
- [| nth2 i j gaussian | (i, j) in (3, 3) |];
@@ -1 +0,0 @@
1
- convolve inputImage filter zero
@@ -1 +0,0 @@
1
- convolve inputImage filter zero
@@ -1,7 +0,0 @@
1
- let inputImage =
2
- let image = [[15, 13, 6, 9, 16],
3
- [12, 5, 15, 4, 13],
4
- [14, 9, 20, 8, 1],
5
- [ 4, 10, 3, 7, 19],
6
- [ 3, 11, 15, 2, 9]] in
7
- [| nth2 i j image | (i, j) in (5, 5) |];
@@ -1,2 +0,0 @@
1
- {["a"] : 5,
2
- [⸨"a"⸩ ++ ⸨"b"⸩] : 6}
@@ -1 +0,0 @@
1
- { ["a"]: 5, ["a" ++ "b"]: 6 }
@@ -1,4 +0,0 @@
1
- let e = ⸨{["a"] : 5,
2
- ["a" ++ "b"] : 6}⸩;
3
- f = ⸨{["ab"] : 12}⸩ in
4
- dict_difference e f
@@ -1,3 +0,0 @@
1
- let e = { ["a"]: 5, ["a" ++ "b"]: 6 };
2
- f = { ["ab"]: 12 }
3
- in dict_difference e f
@@ -1,2 +0,0 @@
1
- {⸨a⸩ : 5,
2
- b : 6} `dict_disjointUnion` {c : ⸨7⸩}
@@ -1 +0,0 @@
1
- { a: 5, b: 6 } `dict_disjointUnion` { c: 7 }
@@ -1,3 +0,0 @@
1
- foldl (*) 1 (dict_foldl concat2 [] {a : [5, 6],
2
- b : [⸨0⸩, 10],
3
- c : [3, 4]})
@@ -1 +0,0 @@
1
- foldl (*) 1 (dict_foldl concat2 [] { a: [5, 6], b: [0, 10], c: [3, 4] })
@@ -1,5 +0,0 @@
1
- let d = {a : 5,
2
- ["a" ++ "b"] : {fst : 6,
3
- snd : ⸨0⸩}};
4
- a = "a" in
5
- d.a * d.[(a ++ "b")].snd
@@ -1,3 +0,0 @@
1
- let d = { a: 5, ["a" ++ "b"]: {fst: 6, snd: 0} };
2
- a = "a"
3
- in d.a * d.[a ++ "b"].snd
@@ -1,5 +0,0 @@
1
- dict_intersectionWith (let x = ⸨2⸩ in
2
- (fun n m = (n + m) * x)) {a : 5,
3
- b : ⸨6⸩,
4
- c : ⸨3⸩} {b : ⸨-6⸩,
5
- c : ⸨7⸩}
@@ -1,4 +0,0 @@
1
- dict_intersectionWith
2
- (let x = 2 in (fun n m = (( n + m ) * x )) )
3
- { a: 5, b: 6, c: 3 }
4
- { b: -6, c: 7 }
@@ -1,8 +0,0 @@
1
- let incHead = let x = ⸨3⸩ in
2
- (fun xs = head xs + x);
3
- d = {a : [⸨5⸩, 6],
4
- b : [⸨9⸩, 10],
5
- c : [3, 4]};
6
- e = {c : []};
7
- d' = dict_map incHead (dict_difference d e) in
8
- d'.a + d'.b
@@ -1,5 +0,0 @@
1
- let incHead = let x = 3 in fun xs -> head xs + x;
2
- d = { a: [5, 6], b: [9, 10], c: [3, 4] };
3
- e = { c: [] };
4
- d' = dict_map incHead (dict_difference d e)
5
- in d'.a + d'.b
@@ -1,6 +0,0 @@
1
- let f {fst : x,
2
- snd : []} = x;
3
- f {fst : x,
4
- snd : (y : ys)} = y in
5
- ⸨{⸨a⸩ : f {snd : [],
6
- fst : ⸨2⸩}}⸩
@@ -1,5 +0,0 @@
1
- let f {fst: x, snd: []} = x;
2
- f {fst: x, snd: (y: ys)} = y
3
- in {
4
- a: f {snd: [], fst: 2 }
5
- }
@@ -1 +0,0 @@
1
- ⸨362⸩ / ⸨9⸩
@@ -1 +0,0 @@
1
- 362 / 9
@@ -1,8 +0,0 @@
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
@@ -1,8 +0,0 @@
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
@@ -1,6 +0,0 @@
1
- let d x y = (x - y) * (x - y) in
2
- let seq1 = ⸨[⸩ ⸨3⸩ ⸨,⸩ ⸨1⸩ ⸨,⸩ 2 ⸨,⸩ 2 ⸨,⸩ 1 ⸨]⸩;
3
- seq2 = ⸨[⸩ ⸨2⸩ ⸨,⸩ ⸨0⸩ ⸨,⸩ ⸨0⸩ ⸨,⸩ 3 ⸨,⸩ 3 ⸨,⸩ 1 ⸨,⸩ 0 ⸨]⸩;
4
- window = ⸨2⸩;
5
- (costs, matched) = computeDTW seq1 seq2 d window in
6
- matched
@@ -1,6 +0,0 @@
1
- let d x y = (x - y) * (x - y) in
2
- let seq1 = [3, 1, 2, 2, 1];
3
- seq2 = [2, 0, 0, 3, 3, 1, 0];
4
- window = 2;
5
- (costs, matched) = computeDTW seq1 seq2 d window in
6
- matched
@@ -1 +0,0 @@
1
- @ (1 + 1) @
@@ -1 +0,0 @@
1
- @ (1 + 1) @
@@ -1,4 +0,0 @@
1
- let filter p [] = [];
2
- filter p (x : xs) = let ys = filter p xs in
3
- if p x then ⸨(x : ys)⸩ else ys in
4
- filter ((<) ⸨5⸩) [⸨8⸩, 4, 7, 3]
@@ -1,6 +0,0 @@
1
- let filter p [] = [];
2
- filter p (x : xs) =
3
- let ys = filter p xs in
4
- if p x then x : ys else ys
5
- in
6
- filter ((<) 5) [8, 4, 7, 3]
@@ -1,4 +0,0 @@
1
- let intersperse [] _ = [];
2
- intersperse [x] _ = [x];
3
- intersperse (x : (y : ys)) sep = (x : ⸨(sep : intersperse ((y : ys)) sep)⸩) in
4
- intersperse ⸨[⸩ 1 ⸨,⸩ 2, 3] 0
@@ -1,4 +0,0 @@
1
- let intersperse [] _ = [];
2
- intersperse [x] _ = [x];
3
- intersperse (x : (y : ys)) sep = ⸨(x : (sep : intersperse (⸨(y : ys)⸩) sep))⸩ in
4
- intersperse ⸨[⸩ 1 ⸨,⸩ 2 ⸨,⸩ 3] 0
@@ -1,5 +0,0 @@
1
- let intersperse [] _ = [];
2
- intersperse [x] _ = [x];
3
- intersperse (x : y : ys) sep = x : sep : intersperse (y : ys) sep
4
- in
5
- intersperse [1, 2, 3] 0
@@ -1 +0,0 @@
1
- length ⸨[⸩ 1 ⸨,⸩ 2 ⸨,⸩ 3 ⸨,⸩ 4 ⸨,⸩ 5 ⸨]⸩
@@ -1 +0,0 @@
1
- length [1, 2, 3, 4, 5]
@@ -1,29 +0,0 @@
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
- }