-
Notifications
You must be signed in to change notification settings - Fork 4
/
u-upd1.q
54 lines (42 loc) · 887 Bytes
/
u-upd1.q
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Exit this file immediately to use the production "Final" implementation by
// uncommenting the \ comment.
// Insert and publish
// Try publishing.
.u.upd1:{[t;x]
t insert x;
pub t; }
\
// Just insert
.u.upd1:{[t;x]
t insert x; }
// Uncomment
// \
.t.x1:();
.t.t:`;
.t.n:0;
// With trap, assign to a global and redefine the caller.
// .t.x:x;
.u.upd1:{[t;x]
.t.n+:1;
v0:@[ t insert;x;`err];
f0: -11h = type v0; // failed, print trace.
if[f0; 0N!"error: ", string t];
if[f0; 0N!{ count y[x;] }[;x] each til count x];
if[f0; .t.x1:x; .t.t:t; .u.upd1: {[t;x]}];
if[f0; : ::]; // return
pub t; }
\
// Other implementations.
// Insert and publish
// Try publishing.
.u.upd1:{[t;x]
t insert x;
pub t; }
/ Local Variables:
/ mode:q
/ q-prog-args: "-p 5010"
/ fill-column: 75
/ comment-column:50
/ comment-start: "/ "
/ comment-end: ""
/ End: