@explorable-viz/fluid 0.11.2 → 0.11.4
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.
- package/dist/fluid/fluid/lib/graphics.fld +91 -63
- package/dist/fluid/shared/fluid.mjs +6 -11
- package/dist/fluid/shared/load-figure.js +45 -52
- package/package.json +2 -2
- package/website/article/fluid/convolution.fld +2 -3
- package/website/article/fluid/dataset/scigen/_1805_02474v1_10.fld +1 -1
- package/website/article/fluid/methane_data.fld +1 -1
- package/website/article/fluid/nonRenewables.fld +2 -2
- package/website/article/fluid/renewables.fld +1 -1
- package/website/article/publications.html +0 -44
|
@@ -1,18 +1,26 @@
|
|
|
1
|
+
# type Colour = Str
|
|
2
|
+
# type Colours = List Colour
|
|
3
|
+
# type Cat = Str
|
|
4
|
+
|
|
5
|
+
# Group has location (0, 0) because it doesn't interfere with positioning of its children.
|
|
6
|
+
# GraphicsElement -> Point
|
|
1
7
|
def coords(Group(gs)): Point(0, 0)
|
|
2
8
|
def coords(Rect(x, y, _, _, _)): Point(x, y)
|
|
3
9
|
def coords(String(x, y, _, _, _)): Point(x, y)
|
|
4
10
|
def coords(Viewport(x, y, _, _, _, _, _, _, _)): Point(x, y)
|
|
5
11
|
|
|
12
|
+
# GraphicsElement -> Float
|
|
6
13
|
def get_x(g):
|
|
7
14
|
def Point(x, _): coords(g)
|
|
8
|
-
|
|
9
15
|
x
|
|
10
16
|
|
|
17
|
+
# GraphicsElement -> Float
|
|
11
18
|
def get_y(g):
|
|
12
19
|
def Point(_, y): coords(g)
|
|
20
|
+
y
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
# Want some kind of typeclass mechanism plus record accessors/updaters.
|
|
23
|
+
# Float -> GraphicsElement -> GraphicsElement
|
|
16
24
|
def set_x(x, Group(gs)):
|
|
17
25
|
error("Group has immutable coordinates")
|
|
18
26
|
def set_x(x, Rect(_, y, w, h, fill)):
|
|
@@ -22,9 +30,14 @@ def set_x(x, String(_, y, str, anchor, baseline)):
|
|
|
22
30
|
def set_x(x, Viewport(_, y, w, h, fill, margin, scale, translate, g)):
|
|
23
31
|
Viewport(x, y, w, h, fill, margin, scale, translate, g)
|
|
24
32
|
|
|
33
|
+
# (Point, Point) -> Point
|
|
25
34
|
def dimensions2((Point(x1, y1), Point(x2, y2))):
|
|
26
35
|
Point(max(x1, x2), max(y1, y2))
|
|
27
36
|
|
|
37
|
+
# For Group, dimensions are relative to implicit coords of (0, 0), since a Group's children are effectively
|
|
38
|
+
# positioned relative to parent of Group. For Polymarker, will probably have to ignore the markers themselves,
|
|
39
|
+
# since they are scale-invariant.
|
|
40
|
+
# GraphicsElement -> Point
|
|
28
41
|
def dimensions(Group(gs)):
|
|
29
42
|
foldl(curry(dimensions2), Point(0, 0), map(coords_op, gs))
|
|
30
43
|
def dimensions(Polyline(ps, _, _)):
|
|
@@ -32,25 +45,28 @@ def dimensions(Polyline(ps, _, _)):
|
|
|
32
45
|
def dimensions(Rect(_, _, w, h, _)): Point(w, h)
|
|
33
46
|
def dimensions(String(_, _, _, _, _)): Point(0, 0)
|
|
34
47
|
def dimensions(Viewport(_, _, w, h, _, _, _, _, _)): Point(w, h)
|
|
48
|
+
|
|
35
49
|
def coords_op(g):
|
|
36
50
|
def (Point(x, y), Point(w, h)):
|
|
37
51
|
prod(coords, dimensions, g)
|
|
38
|
-
|
|
39
52
|
Point(x + w, y + h)
|
|
40
53
|
|
|
54
|
+
# GraphicsElement -> Float
|
|
41
55
|
def width(g):
|
|
42
56
|
def Point(w, _): dimensions(g)
|
|
43
|
-
|
|
44
57
|
w
|
|
45
58
|
|
|
59
|
+
# GraphicsElement -> Float
|
|
46
60
|
def height(g):
|
|
47
61
|
def Point(_, h): dimensions(g)
|
|
48
|
-
|
|
49
62
|
h
|
|
50
63
|
|
|
64
|
+
# Float -> Float -> List GraphicsElement -> List GraphicsElement
|
|
51
65
|
def spaceRight(z, sep, gs):
|
|
52
66
|
zipWith(set_x, iterate(length(gs), (+)(sep), z), gs)
|
|
53
67
|
|
|
68
|
+
# Bake colour decisions into the library for the time being. Provide two palettes, so we can have two
|
|
69
|
+
# different sets of categorical values (e.g. countries and energy types). Palettes from colorbrewer2.org
|
|
54
70
|
def colours1: [
|
|
55
71
|
"#66c2a5",
|
|
56
72
|
"#a6d854",
|
|
@@ -73,23 +89,29 @@ def colours2: [
|
|
|
73
89
|
"#f781bf"
|
|
74
90
|
]
|
|
75
91
|
|
|
92
|
+
# Compositionality principle: child coords/dimensions are always expressed directly using parent reference
|
|
93
|
+
# frame, to avoid depending on content of child, and so are not themselves scaled. Polyline can't be scaled
|
|
94
|
+
# directly because it inherits its frame of reference from its parent. For Viewport, margin will shrink the
|
|
95
|
+
# available area, possibly to zero, at which point nothing will be rendered.
|
|
96
|
+
# Float -> GraphicsElement -> GraphicsElement
|
|
76
97
|
def scaleToWidth(w, Rect(x, y, _, h, fill)):
|
|
77
98
|
Rect(x, y, w, h, fill)
|
|
78
99
|
def scaleToWidth(w, Viewport(x, y, w0, h, fill, margin, Scale(x_scale, y_scale), translate, g)):
|
|
79
|
-
def scale:
|
|
80
|
-
Scale((x_scale * w) / w0, y_scale)
|
|
81
|
-
|
|
100
|
+
def scale: Scale((x_scale * w) / w0, y_scale)
|
|
82
101
|
Viewport(x, y, w, h, fill, margin, scale, translate, g)
|
|
83
102
|
|
|
103
|
+
# Float -> List GraphicsElement -> List GraphicsElement
|
|
84
104
|
def stackRight(sep, gs):
|
|
85
105
|
map(scaleToWidth(1 - sep), spaceRight(sep / 2, 1, gs))
|
|
86
106
|
|
|
107
|
+
# Float -> List GraphicsElement -> GraphicsElement
|
|
87
108
|
def groupRight(sep, gs):
|
|
88
109
|
Viewport(0, 0, length(gs), maximum(map(height, gs)), "none", 0, Scale(1, 1), Translate(0, 0), Group(stackRight(sep, gs)))
|
|
89
110
|
|
|
111
|
+
# Heuristic saying how often to place a tick on an axis of length n.
|
|
112
|
+
# Float -> Float
|
|
90
113
|
def tickEvery(n):
|
|
91
|
-
def m:
|
|
92
|
-
floor(logBase(10, n))
|
|
114
|
+
def m: floor(logBase(10, n))
|
|
93
115
|
|
|
94
116
|
if n <= 2 * 10 ** m: 2 * 10 ** (m - 1)
|
|
95
117
|
else: 10 ** m
|
|
@@ -101,47 +123,45 @@ def defaultMargin: 24
|
|
|
101
123
|
def markerRadius: 3.5
|
|
102
124
|
def tickLength: 4
|
|
103
125
|
|
|
126
|
+
# Helpers for axis functions.
|
|
127
|
+
# Orient -> Colour -> Float -> GraphicsElement
|
|
104
128
|
def tick(Horiz, colour, len):
|
|
105
129
|
Line(Point(0, 0), Point(0, 0 - len), colour, axisStrokeWidth)
|
|
106
130
|
def tick(Vert, colour, len):
|
|
107
131
|
Line(Point(0, 0), Point(0 - len, 0), colour, axisStrokeWidth)
|
|
108
132
|
|
|
133
|
+
# Orient -> Float -> Float -> Str -> GraphicsElement
|
|
109
134
|
def label(Horiz, x, distance, str):
|
|
110
135
|
String(x, (0 - distance) - 4, str, "middle", "hanging")
|
|
111
136
|
def label(Vert, x, distance, str):
|
|
112
137
|
String(0 - distance, x, str, "end", "central")
|
|
113
138
|
|
|
139
|
+
# Orient -> Colour -> Float -> Str -> GraphicsElement
|
|
114
140
|
def labelledTick(orient, colour, len, str):
|
|
115
141
|
Group([
|
|
116
142
|
tick(orient, colour, len),
|
|
117
143
|
label(orient, 0, len, str)
|
|
118
144
|
])
|
|
119
145
|
|
|
146
|
+
# Orient -> Float -> Float -> Point
|
|
120
147
|
def mkPoint(Horiz, x, y): Point(y, x)
|
|
121
148
|
def mkPoint(Vert, x, y): Point(x, y)
|
|
122
149
|
|
|
150
|
+
# x is position of this axis on the other axis. Returns axis and position of last tick.
|
|
151
|
+
# Orient -> Float -> Float -> Float -> GraphicsElement
|
|
123
152
|
def axis(orient, x, start, end):
|
|
124
|
-
def tickSp:
|
|
125
|
-
|
|
126
|
-
def
|
|
127
|
-
|
|
128
|
-
def
|
|
129
|
-
ceilingToNearest(end, tickSp)
|
|
130
|
-
def n:
|
|
131
|
-
floor((end - firstTick) / tickSp) + 1
|
|
132
|
-
def ys:
|
|
133
|
-
iterate(n, (+)(tickSp), firstTick)
|
|
153
|
+
def tickSp: tickEvery(end - start)
|
|
154
|
+
def firstTick: ceilingToNearest(start, tickSp)
|
|
155
|
+
def lastTick: ceilingToNearest(end, tickSp)
|
|
156
|
+
def n: floor((end - firstTick) / tickSp) + 1
|
|
157
|
+
def ys: iterate(n, (+)(tickSp), firstTick)
|
|
134
158
|
def ys:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
case False: ys
|
|
159
|
+
if firstTick > start: start :| ys
|
|
160
|
+
else: ys
|
|
138
161
|
def ys:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
case False: ys
|
|
143
|
-
def ps:
|
|
144
|
-
map(mkPoint(orient, x), ys)
|
|
162
|
+
if lastTick > end: concat2(ys, [lastTick])
|
|
163
|
+
else: ys
|
|
164
|
+
def ps: map(mkPoint(orient, x), ys)
|
|
145
165
|
def ax:
|
|
146
166
|
Group([
|
|
147
167
|
Line(head(ps), last(ps), axisColour, axisStrokeWidth),
|
|
@@ -150,11 +170,11 @@ def axis(orient, x, start, end):
|
|
|
150
170
|
|
|
151
171
|
(ax, lastTick)
|
|
152
172
|
|
|
173
|
+
# x is position of this axis on the other axis.
|
|
174
|
+
# Orient -> Float -> List Cat -> GraphicsElement
|
|
153
175
|
def catAxis(orient, x, catValues):
|
|
154
|
-
def ys:
|
|
155
|
-
|
|
156
|
-
def ps:
|
|
157
|
-
map(mkPoint(orient, x), ys)
|
|
176
|
+
def ys: iterate(length(catValues) + 1, (+)(1), 0)
|
|
177
|
+
def ps: map(mkPoint(orient, x), ys)
|
|
158
178
|
|
|
159
179
|
Group([
|
|
160
180
|
Line(head(ps), last(ps), axisColour, axisStrokeWidth),
|
|
@@ -162,14 +182,18 @@ def catAxis(orient, x, catValues):
|
|
|
162
182
|
Polymarkers(flip(map, tail(ps), lambda Point(x, y): Point(x - 0.5, y)), map(label(orient, -0.5, 0), catValues))
|
|
163
183
|
])
|
|
164
184
|
|
|
185
|
+
# Float -> Float -> Float -> Float -> List GraphicsElement -> GraphicsElement
|
|
165
186
|
def viewport(x_start, x_finish, y_finish, margin, gs):
|
|
166
187
|
Viewport(0, 0, x_finish - x_start, y_finish, backgroundColour, margin, Scale(1, 1), Translate(0 - x_start, 0), Group(gs))
|
|
167
188
|
|
|
189
|
+
# Plot a map of x values to lists of (categorical value, y value) pairs. Importantly, assume all data is uniform
|
|
190
|
+
# (categorical keys are the same for each x value and are ordered the same each time).
|
|
191
|
+
# Bool -> Colours -> Float -> List (Float, List (Cat, Float)) -> GraphicsElement
|
|
168
192
|
def lineChart(withAxes, colours, x_start, data):
|
|
169
193
|
def xs: map(fst, data)
|
|
170
|
-
def nCat:
|
|
171
|
-
length(snd(head(data)))
|
|
194
|
+
def nCat: length(snd(head(data)))
|
|
172
195
|
|
|
196
|
+
# (Int, Colour) -> GraphicsElement
|
|
173
197
|
def plot((n, colour)):
|
|
174
198
|
def ps:
|
|
175
199
|
map(lambda (x, kvs): Point(x, snd(nth(n, kvs))), data)
|
|
@@ -179,68 +203,72 @@ def lineChart(withAxes, colours, x_start, data):
|
|
|
179
203
|
Polymarkers(ps, repeat(length(ps), Circle(0, 0, markerRadius, colour)))
|
|
180
204
|
])
|
|
181
205
|
|
|
206
|
+
# List GraphicsElement
|
|
182
207
|
def lines:
|
|
183
208
|
zipWith(curry(plot), iterate(nCat, (+)(1), 0), colours)
|
|
184
209
|
def x_finish: last(xs)
|
|
185
210
|
def y_finish:
|
|
186
211
|
maximum(flip(map, data, lambda (_, kvs): maximum(map(snd, kvs))))
|
|
187
212
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
viewport(x_start, x_finish, y_finish', defaultMargin, x_axis :| y_axis :| lines)
|
|
196
|
-
case False:
|
|
197
|
-
viewport(x_start, x_finish, y_finish, 0, lines)
|
|
213
|
+
if withAxes:
|
|
214
|
+
def (x_axis, x_finish): axis(Horiz, 0, x_start, x_finish)
|
|
215
|
+
def (y_axis, y_finish_): axis(Vert, x_start, 0, y_finish)
|
|
216
|
+
viewport(x_start, x_finish, y_finish_, defaultMargin, x_axis :| y_axis :| lines)
|
|
217
|
+
else:
|
|
218
|
+
viewport(x_start, x_finish, y_finish, 0, lines)
|
|
198
219
|
|
|
220
|
+
# Plot a chart of categorical values on the x-axis and renderings of the corresponding a-value on the y-axis.
|
|
221
|
+
# (Colours -> List a -> GraphicsElement) -> Bool -> Colours -> Float -> List (Cat, a) -> GraphicsElement
|
|
199
222
|
def categoricalChart(plotValue, withAxes, colours, sep, data):
|
|
200
223
|
def gs:
|
|
201
224
|
stackRight(sep, plotValue(colours, map(snd, data)))
|
|
202
225
|
def w: length(gs)
|
|
203
|
-
def h:
|
|
204
|
-
maximum(map(height, gs))
|
|
205
|
-
|
|
206
|
-
match withAxes:
|
|
207
|
-
case True:
|
|
208
|
-
def x_axis:
|
|
209
|
-
catAxis(Horiz, 0, map(fst, data))
|
|
210
|
-
def (y_axis, h'): axis(Vert, 0, 0, h)
|
|
226
|
+
def h: maximum(map(height, gs))
|
|
211
227
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
228
|
+
if withAxes:
|
|
229
|
+
def x_axis: catAxis(Horiz, 0, map(fst, data))
|
|
230
|
+
def (y_axis, h_): axis(Vert, 0, 0, h)
|
|
231
|
+
viewport(0, w, h_, defaultMargin, concat2(gs, [x_axis, y_axis]))
|
|
232
|
+
else:
|
|
233
|
+
viewport(0, w, h, 0, gs)
|
|
215
234
|
|
|
235
|
+
# Colours -> List a -> GraphicsElement
|
|
216
236
|
def rects(colours, ns):
|
|
217
237
|
zipWith(lambda colour, n: Rect(0, 0, 1, n, colour), colours, ns)
|
|
218
238
|
|
|
239
|
+
# First component of data (categorical value) currently ignored; values just mapped positionally to colors.
|
|
240
|
+
# Can we use Group instead of Viewport here?
|
|
241
|
+
# Colours -> List (a, Num) -> GraphicsElement
|
|
219
242
|
def stackedBar(colours, ns):
|
|
220
243
|
def heights: map(snd, ns)
|
|
221
|
-
def subtotals:
|
|
222
|
-
|
|
223
|
-
def dims:
|
|
224
|
-
zip(0 :| subtotals, heights)
|
|
244
|
+
def subtotals: scanl1((+), 0, heights)
|
|
245
|
+
def dims: zip(0 :| subtotals, heights)
|
|
225
246
|
def rects:
|
|
226
247
|
map(lambda ((y, height), colour): Rect(0, y, 1, height, colour), zip(dims, colours))
|
|
227
248
|
|
|
228
249
|
Viewport(0, 0, 1, last(subtotals), "none", 0, Scale(1, 1), Translate(0, 0), Group(rects))
|
|
229
250
|
|
|
251
|
+
# Bool -> Colours -> Float -> List (a, Float) -> GraphicsElement
|
|
230
252
|
def barChart:
|
|
231
253
|
categoricalChart(rects)
|
|
232
254
|
|
|
255
|
+
# For each categorical value of type a, plot a bar chart for the corresponding b-indexed data.
|
|
256
|
+
# Bool -> Colours -> Float -> List (a, List (b, Float)) -> GraphicsElement
|
|
233
257
|
def groupedBarChart:
|
|
234
258
|
categoricalChart(compose(map, flip(barChart(False), 0)))
|
|
235
259
|
|
|
260
|
+
# See stackedBar for strong (unjustified) assumption about uniformity of data.
|
|
261
|
+
# Bool -> Colours -> Num -> List (a, List (b, Num)) -> GraphicsElement
|
|
236
262
|
def stackedBarChart:
|
|
237
263
|
categoricalChart(compose(map, stackedBar))
|
|
238
264
|
|
|
265
|
+
# Bit of a hack, but how text fits into our model is a bit unclear at the moment.
|
|
266
|
+
# Str -> GraphicsElement -> GraphicsElement
|
|
239
267
|
def caption(str, Viewport(x, y, w, h, fill, margin, scale, translate, g)):
|
|
240
|
-
def
|
|
268
|
+
def g_:
|
|
241
269
|
Group([
|
|
242
270
|
String(x + w / 2, -2, str, "middle", "hanging"),
|
|
243
271
|
Viewport(0, 0, w, h, fill, margin, scale, translate, g)
|
|
244
272
|
])
|
|
245
273
|
|
|
246
|
-
Viewport(x, y, w, h, backgroundColour, defaultMargin / 2 + 4, Scale(1, 1), Translate(0, 0),
|
|
274
|
+
Viewport(x, y, w, h, backgroundColour, defaultMargin / 2 + 4, Scale(1, 1), Translate(0, 0), g_)
|
|
@@ -10312,6 +10312,7 @@ var inlinable = (m) => (doc) => {
|
|
|
10312
10312
|
}
|
|
10313
10313
|
fail();
|
|
10314
10314
|
};
|
|
10315
|
+
var expr = /* @__PURE__ */ Mode(Expr);
|
|
10315
10316
|
var format = (m) => (w) => (doc) => {
|
|
10316
10317
|
if (inlinable(m)(doc) && width(m)(doc) < (80 - w | 0)) {
|
|
10317
10318
|
return Inline;
|
|
@@ -10371,9 +10372,8 @@ var renderWithIndent = (m) => (i) => (w) => (doc) => {
|
|
|
10371
10372
|
}
|
|
10372
10373
|
fail();
|
|
10373
10374
|
};
|
|
10374
|
-
var expr = /* @__PURE__ */ Mode(Expr);
|
|
10375
10375
|
|
|
10376
|
-
// output-es/Pretty.
|
|
10376
|
+
// output-es/Pretty.Util/index.js
|
|
10377
10377
|
var vsep = (v) => {
|
|
10378
10378
|
if (v.tag === "Nil") {
|
|
10379
10379
|
return Empty;
|
|
@@ -18933,12 +18933,6 @@ var isHexDigit = (c) => {
|
|
|
18933
18933
|
var isAlphaNum = (x) => checkAttr([524288, 512, 4096, 1048576, 16384, 8388608, 4194304, 2097152, 131072, 256, 16777216])(x);
|
|
18934
18934
|
var isAlpha = (x) => checkAttr([4096, 512, 524288, 1048576, 16384])(x);
|
|
18935
18935
|
|
|
18936
|
-
// output-es/Parse.Error/index.js
|
|
18937
|
-
var prettyParseError = (v) => "ParseError on line " + showIntImpl(v._2.line) + ", column " + showIntImpl(v._2.column) + ":\n" + v._1;
|
|
18938
|
-
|
|
18939
|
-
// output-es/Parse.Constants/index.js
|
|
18940
|
-
var opChars = [":", "!", "#", "$", "%", "&", "*", "+", ".", "/", "<", "=", ">", "?", "@", "\\", "^", "|", "-", "~"];
|
|
18941
|
-
|
|
18942
18936
|
// output-es/Parsing.Combinators.Array/index.js
|
|
18943
18937
|
var many2 = (p) => {
|
|
18944
18938
|
const $0 = monadRecParserT.tailRecM((xs) => (v2, $02, $1, $2, $3) => {
|
|
@@ -19304,7 +19298,8 @@ var stringChar = /* @__PURE__ */ withErrorMessage((state1, more, lift12, $$throw
|
|
|
19304
19298
|
$$throw2,
|
|
19305
19299
|
(state2, a) => more((v2) => done(state2, $Maybe("Just", a)))
|
|
19306
19300
|
)))("string character");
|
|
19307
|
-
var
|
|
19301
|
+
var opChars = [":", "!", "#", "$", "%", "&", "*", "+", ".", "/", "<", "=", ">", "?", "@", "\\", "^", "|", "-", "~"];
|
|
19302
|
+
var lexeme = (v) => (state1, more, lift12, $$throw2, done) => more((v2) => more((v1) => v(
|
|
19308
19303
|
state1,
|
|
19309
19304
|
more,
|
|
19310
19305
|
lift12,
|
|
@@ -19361,7 +19356,7 @@ var stringLiteral = /* @__PURE__ */ lexeme(/* @__PURE__ */ withErrorMessage(/* @
|
|
|
19361
19356
|
))
|
|
19362
19357
|
));
|
|
19363
19358
|
})())("literal string"));
|
|
19364
|
-
var keywords = ["
|
|
19359
|
+
var keywords = ["case", "def", "else", "for", "if", "import", "in", "lambda", "match"];
|
|
19365
19360
|
var unreserved = (p) => (state1, more, lift12, $$throw2, done) => more((v1) => p(
|
|
19366
19361
|
state1,
|
|
19367
19362
|
more,
|
|
@@ -20101,7 +20096,7 @@ var topLevel = (p) => (state1, more, lift12, $$throw2, done) => more((v2) => mor
|
|
|
20101
20096
|
var parse = (parser) => (input) => {
|
|
20102
20097
|
const $0 = runParserT2(input)(parser)(initialPos)._1;
|
|
20103
20098
|
if ($0.tag === "Left") {
|
|
20104
|
-
return $Either("Left",
|
|
20099
|
+
return $Either("Left", "ParseError on line " + showIntImpl($0._1._2.line) + ", column " + showIntImpl($0._1._2.column) + ":\n" + $0._1._1);
|
|
20105
20100
|
}
|
|
20106
20101
|
if ($0.tag === "Right") {
|
|
20107
20102
|
return $Either("Right", $0._1);
|
|
@@ -24025,6 +24025,45 @@ var nubBy = (comp) => (xs) => {
|
|
|
24025
24025
|
}
|
|
24026
24026
|
return [];
|
|
24027
24027
|
};
|
|
24028
|
+
var transpose = (xs) => {
|
|
24029
|
+
const go = (go$a0$copy) => (go$a1$copy) => {
|
|
24030
|
+
let go$a0 = go$a0$copy, go$a1 = go$a1$copy, go$c = true, go$r;
|
|
24031
|
+
while (go$c) {
|
|
24032
|
+
const idx = go$a0, allArrays = go$a1;
|
|
24033
|
+
const v = foldlArray((acc) => (nextArr) => {
|
|
24034
|
+
if (idx >= 0 && idx < nextArr.length) {
|
|
24035
|
+
const $0 = nextArr[idx];
|
|
24036
|
+
return $Maybe(
|
|
24037
|
+
"Just",
|
|
24038
|
+
(() => {
|
|
24039
|
+
if (acc.tag === "Nothing") {
|
|
24040
|
+
return [$0];
|
|
24041
|
+
}
|
|
24042
|
+
if (acc.tag === "Just") {
|
|
24043
|
+
return snoc(acc._1)($0);
|
|
24044
|
+
}
|
|
24045
|
+
fail();
|
|
24046
|
+
})()
|
|
24047
|
+
);
|
|
24048
|
+
}
|
|
24049
|
+
return acc;
|
|
24050
|
+
})(Nothing)(xs);
|
|
24051
|
+
if (v.tag === "Nothing") {
|
|
24052
|
+
go$c = false;
|
|
24053
|
+
go$r = allArrays;
|
|
24054
|
+
continue;
|
|
24055
|
+
}
|
|
24056
|
+
if (v.tag === "Just") {
|
|
24057
|
+
go$a0 = idx + 1 | 0;
|
|
24058
|
+
go$a1 = snoc(allArrays)(v._1);
|
|
24059
|
+
continue;
|
|
24060
|
+
}
|
|
24061
|
+
fail();
|
|
24062
|
+
}
|
|
24063
|
+
return go$r;
|
|
24064
|
+
};
|
|
24065
|
+
return go(0)([]);
|
|
24066
|
+
};
|
|
24028
24067
|
var foldM = (dictMonad) => (f) => (b) => ($0) => unconsImpl((v) => dictMonad.Applicative0().pure(b), (a) => (as) => dictMonad.Bind1().bind(f(b)(a))((b$p) => foldM(dictMonad)(f)(b$p)(as)), $0);
|
|
24029
24068
|
var elem = (dictEq) => (a) => (arr) => {
|
|
24030
24069
|
const $0 = findIndexImpl(Just, Nothing, (v) => dictEq.eq(v)(a), arr);
|
|
@@ -27856,7 +27895,7 @@ var renderWithIndent = (m) => (i) => (w) => (doc2) => {
|
|
|
27856
27895
|
fail();
|
|
27857
27896
|
};
|
|
27858
27897
|
|
|
27859
|
-
// output-es/Pretty.
|
|
27898
|
+
// output-es/Pretty.Util/index.js
|
|
27860
27899
|
var sep$p = (v) => (v1) => {
|
|
27861
27900
|
if (v1.tag === "Nil") {
|
|
27862
27901
|
return Empty;
|
|
@@ -43386,47 +43425,6 @@ var toStringWith = (v) => {
|
|
|
43386
43425
|
fail();
|
|
43387
43426
|
};
|
|
43388
43427
|
|
|
43389
|
-
// output-es/Util.Array/index.js
|
|
43390
|
-
var transpose2 = (xs) => {
|
|
43391
|
-
const go = (go$a0$copy) => (go$a1$copy) => {
|
|
43392
|
-
let go$a0 = go$a0$copy, go$a1 = go$a1$copy, go$c = true, go$r;
|
|
43393
|
-
while (go$c) {
|
|
43394
|
-
const idx = go$a0, allArrays = go$a1;
|
|
43395
|
-
const v = foldlArray((acc) => (nextArr) => {
|
|
43396
|
-
if (idx >= 0 && idx < nextArr.length) {
|
|
43397
|
-
const $0 = nextArr[idx];
|
|
43398
|
-
return $Maybe(
|
|
43399
|
-
"Just",
|
|
43400
|
-
(() => {
|
|
43401
|
-
if (acc.tag === "Nothing") {
|
|
43402
|
-
return [$0];
|
|
43403
|
-
}
|
|
43404
|
-
if (acc.tag === "Just") {
|
|
43405
|
-
return snoc(acc._1)($0);
|
|
43406
|
-
}
|
|
43407
|
-
fail();
|
|
43408
|
-
})()
|
|
43409
|
-
);
|
|
43410
|
-
}
|
|
43411
|
-
return acc;
|
|
43412
|
-
})(Nothing)(xs);
|
|
43413
|
-
if (v.tag === "Nothing") {
|
|
43414
|
-
go$c = false;
|
|
43415
|
-
go$r = allArrays;
|
|
43416
|
-
continue;
|
|
43417
|
-
}
|
|
43418
|
-
if (v.tag === "Just") {
|
|
43419
|
-
go$a0 = idx + 1 | 0;
|
|
43420
|
-
go$a1 = snoc(allArrays)(v._1);
|
|
43421
|
-
continue;
|
|
43422
|
-
}
|
|
43423
|
-
fail();
|
|
43424
|
-
}
|
|
43425
|
-
return go$r;
|
|
43426
|
-
};
|
|
43427
|
-
return go(0)([]);
|
|
43428
|
-
};
|
|
43429
|
-
|
|
43430
43428
|
// output-es/App.View.TableView/index.js
|
|
43431
43429
|
var toUnfoldable6 = /* @__PURE__ */ (() => {
|
|
43432
43430
|
const $0 = unfoldableArray.unfoldr((xs) => {
|
|
@@ -43619,7 +43617,7 @@ var viewableTableViewUnit = {
|
|
|
43619
43617
|
fail();
|
|
43620
43618
|
};
|
|
43621
43619
|
const $3 = selectAll2(".table-row")(rootElement);
|
|
43622
|
-
const column_isVisible = arrayMap(any(visible($0.length >= 10 ? Interactive : Everything)))(
|
|
43620
|
+
const column_isVisible = arrayMap(any(visible($0.length >= 10 ? Interactive : Everything)))(transpose($1));
|
|
43623
43621
|
const column_visiblePred = (column_visiblePred$a0$copy) => {
|
|
43624
43622
|
let column_visiblePred$a0 = column_visiblePred$a0$copy, column_visiblePred$c = true, column_visiblePred$r;
|
|
43625
43623
|
while (column_visiblePred$c) {
|
|
@@ -46975,12 +46973,6 @@ var isHexDigit = (c) => {
|
|
|
46975
46973
|
var isAlphaNum = (x2) => checkAttr([524288, 512, 4096, 1048576, 16384, 8388608, 4194304, 2097152, 131072, 256, 16777216])(x2);
|
|
46976
46974
|
var isAlpha = (x2) => checkAttr([4096, 512, 524288, 1048576, 16384])(x2);
|
|
46977
46975
|
|
|
46978
|
-
// output-es/Parse.Error/index.js
|
|
46979
|
-
var prettyParseError = (v) => "ParseError on line " + showIntImpl(v._2.line) + ", column " + showIntImpl(v._2.column) + ":\n" + v._1;
|
|
46980
|
-
|
|
46981
|
-
// output-es/Parse.Constants/index.js
|
|
46982
|
-
var opChars = [":", "!", "#", "$", "%", "&", "*", "+", ".", "/", "<", "=", ">", "?", "@", "\\", "^", "|", "-", "~"];
|
|
46983
|
-
|
|
46984
46976
|
// output-es/Parsing.Combinators.Array/index.js
|
|
46985
46977
|
var many2 = (p) => {
|
|
46986
46978
|
const $0 = monadRecParserT.tailRecM((xs) => (v2, $02, $1, $2, $3) => {
|
|
@@ -47341,7 +47333,8 @@ var stringChar = /* @__PURE__ */ withErrorMessage((state1, more, lift12, $$throw
|
|
|
47341
47333
|
$$throw2,
|
|
47342
47334
|
(state2, a) => more((v2) => done(state2, $Maybe("Just", a)))
|
|
47343
47335
|
)))("string character");
|
|
47344
|
-
var
|
|
47336
|
+
var opChars = [":", "!", "#", "$", "%", "&", "*", "+", ".", "/", "<", "=", ">", "?", "@", "\\", "^", "|", "-", "~"];
|
|
47337
|
+
var lexeme = (v) => (state1, more, lift12, $$throw2, done) => more((v2) => more((v1) => v(
|
|
47345
47338
|
state1,
|
|
47346
47339
|
more,
|
|
47347
47340
|
lift12,
|
|
@@ -47398,7 +47391,7 @@ var stringLiteral = /* @__PURE__ */ lexeme(/* @__PURE__ */ withErrorMessage(/* @
|
|
|
47398
47391
|
))
|
|
47399
47392
|
));
|
|
47400
47393
|
})())("literal string"));
|
|
47401
|
-
var keywords = ["
|
|
47394
|
+
var keywords = ["case", "def", "else", "for", "if", "import", "in", "lambda", "match"];
|
|
47402
47395
|
var unreserved = (p) => (state1, more, lift12, $$throw2, done) => more((v1) => p(
|
|
47403
47396
|
state1,
|
|
47404
47397
|
more,
|
|
@@ -48138,7 +48131,7 @@ var topLevel = (p) => (state1, more, lift12, $$throw2, done) => more((v2) => mor
|
|
|
48138
48131
|
var parse = (parser2) => (input) => {
|
|
48139
48132
|
const $0 = runParserT2(input)(parser2)(initialPos)._1;
|
|
48140
48133
|
if ($0.tag === "Left") {
|
|
48141
|
-
return $Either("Left",
|
|
48134
|
+
return $Either("Left", "ParseError on line " + showIntImpl($0._1._2.line) + ", column " + showIntImpl($0._1._2.column) + ":\n" + $0._1._1);
|
|
48142
48135
|
}
|
|
48143
48136
|
if ($0.tag === "Right") {
|
|
48144
48137
|
return $Either("Right", $0._1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@explorable-viz/fluid",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
4
4
|
"description": "A functional programming language which integrates a bidirectional dynamic analysis, connecting 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": {
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"karma-mocha": "2.0.1",
|
|
76
76
|
"karma-mocha-reporter": "2.2.5",
|
|
77
77
|
"mocha": "^10.0.0",
|
|
78
|
-
"puppeteer": "
|
|
78
|
+
"puppeteer": "23.11.1",
|
|
79
79
|
"purescript": "0.15.10",
|
|
80
80
|
"purescript-language-server": "0.16.6",
|
|
81
81
|
"purescript-psa": "0.8.2",
|
|
@@ -19,9 +19,8 @@ def convolve(image, kernel):
|
|
|
19
19
|
def area: i * j
|
|
20
20
|
|
|
21
21
|
def interMatrix(m_, n_):
|
|
22
|
-
|
|
23
|
-
[| kernel!(i_, j_)
|
|
24
|
-
lookup(m_ + i_ - 1 - half_i, n_ + j_ - 1 - half_j, image)
|
|
22
|
+
@doc(f"""average these to compute element ({m_}, {n_})""")
|
|
23
|
+
[| lookup(m_ + i_ - 1 - half_i, n_ + j_ - 1 - half_j, image) * kernel!(i_, j_)
|
|
25
24
|
for (i_, j_) in (i, j) |]
|
|
26
25
|
|
|
27
26
|
[| matrixSum(interMatrix(m_, n_)) |quot| area for (m_, n_) in (m, n) |]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
def tableData:
|
|
2
|
-
loadJson("
|
|
2
|
+
loadJson("../dataset/SciGen/1805.02474v1-10.json")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
def methane: loadJson("
|
|
1
|
+
def methane: loadJson("../dataset/methane-emissions.json")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
def renewables: loadJson("
|
|
1
|
+
def renewables: loadJson("../dataset/renewable-new.json")
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
7
|
-
<title>Some publications</title>
|
|
8
|
-
<link href="css/styles.css" rel="stylesheet" type="text/css">
|
|
9
|
-
<script src="https://kit.fontawesome.com/20cf8b42c0.js" crossorigin="anonymous"></script>
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
|
|
13
|
-
<div class="grid-container double-size">
|
|
14
|
-
<div></div>
|
|
15
|
-
<div></div>
|
|
16
|
-
<div class="flex-left-align">
|
|
17
|
-
<div></div>
|
|
18
|
-
<h2>Preprints</h2>
|
|
19
|
-
|
|
20
|
-
<a href="https://dynamicaspects.org/papers/authoring-assistant.pdf">AI-Assisted Authoring for Transparent, Data-Driven Documents</a>
|
|
21
|
-
Alfonso Piscitelli, Cristina David, Mattia De Rosa, Ali Muhammad, Federico Nanni, Jacob Pake, Roly Perera, Jessy Sodimu, Chenyiqiu Zheng
|
|
22
|
-
<br>(Under review)
|
|
23
|
-
<br><br>
|
|
24
|
-
<a href="https://bentnib.org/galois-autodiff.pdf">
|
|
25
|
-
<strong>Galois Slicing as Automatic Differentiation</strong>
|
|
26
|
-
</a>
|
|
27
|
-
Robert Atkey, Roly Perera
|
|
28
|
-
<br>(Under review)
|
|
29
|
-
|
|
30
|
-
<h2>Recent papers</h2>
|
|
31
|
-
<a href="https://link.springer.com/chapter/10.1007/978-3-031-91118-7_6">
|
|
32
|
-
Cognacy Queries over Dependence Graphs for Transparent Visualisations
|
|
33
|
-
</a>
|
|
34
|
-
Joseph Bond, Cristina David, Minh Nguyen, Dominic Orchard, Roly Perera
|
|
35
|
-
<br>European Symposium on Programming (ESOP 2025)
|
|
36
|
-
<br><br>
|
|
37
|
-
<a href="https://arxiv.org/abs/2109.00445">Linked Visualisations via Galois Dependencies</a>
|
|
38
|
-
Roly Perera, Minh Nguyen, Tomas Petricek, Meng Wang
|
|
39
|
-
<br>
|
|
40
|
-
ACM SIGPLAN Conference on Principles of Programming Languages (POPL 2022)
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</body>
|
|
44
|
-
</html>
|