@@ -11,7 +11,7 @@ fn inputs() -> impl Strategy<Value = Vec<(u32, u32)>> {
11
11
12
12
/// The original way to use datafrog -- computes reachable nodes from a set of edges
13
13
fn reachable_with_var_join ( edges : & [ ( u32 , u32 ) ] ) -> Relation < ( u32 , u32 ) > {
14
- let edges: Relation < _ > = edges. iter ( ) . collect ( ) ;
14
+ let edges: Relation < ( u32 , u32 ) > = edges. iter ( ) . collect ( ) ;
15
15
let mut iteration = Iteration :: new ( ) ;
16
16
17
17
let edges_by_successor = iteration. variable :: < ( u32 , u32 ) > ( "edges_invert" ) ;
@@ -22,15 +22,15 @@ fn reachable_with_var_join(edges: &[(u32, u32)]) -> Relation<(u32, u32)> {
22
22
23
23
while iteration. changed ( ) {
24
24
// reachable(N1, N3) :- edges(N1, N2), reachable(N2, N3).
25
- reachable. from_join ( & reachable, & edges_by_successor, |& _ , & n3, & n1| ( n1, n3) ) ;
25
+ reachable. from_join ( & reachable, & edges_by_successor, |_ : ( u32 , ) , n3, n1| ( n1, n3) ) ;
26
26
}
27
27
28
28
reachable. complete ( )
29
29
}
30
30
31
31
/// Like `reachable`, but using a relation as an input to `from_join`
32
32
fn reachable_with_relation_join ( edges : & [ ( u32 , u32 ) ] ) -> Relation < ( u32 , u32 ) > {
33
- let edges: Relation < _ > = edges. iter ( ) . collect ( ) ;
33
+ let edges: Relation < ( u32 , u32 ) > = edges. iter ( ) . collect ( ) ;
34
34
let mut iteration = Iteration :: new ( ) ;
35
35
36
36
// NB. Changed from `reachable_with_var_join`:
@@ -41,7 +41,7 @@ fn reachable_with_relation_join(edges: &[(u32, u32)]) -> Relation<(u32, u32)> {
41
41
42
42
while iteration. changed ( ) {
43
43
// reachable(N1, N3) :- edges(N1, N2), reachable(N2, N3).
44
- reachable. from_join ( & reachable, & edges_by_successor, |& _ , & n3, & n1| ( n1, n3) ) ;
44
+ reachable. from_join ( & reachable, & edges_by_successor, |_ : ( u32 , ) , n3, n1| ( n1, n3) ) ;
45
45
}
46
46
47
47
reachable. complete ( )
@@ -60,7 +60,7 @@ fn reachable_with_leapfrog(edges: &[(u32, u32)]) -> Relation<(u32, u32)> {
60
60
// reachable(N1, N3) :- edges(N1, N2), reachable(N2, N3).
61
61
reachable. from_leapjoin (
62
62
& reachable,
63
- edges_by_successor. extend_with ( |& ( n2, _) | n2 ) ,
63
+ edges_by_successor. extend_with ( |& ( n2, _) | ( n2 , ) ) ,
64
64
|& ( _, n3) , & n1| ( n1, n3) ,
65
65
) ;
66
66
}
@@ -86,7 +86,7 @@ fn sum_join_via_var(
86
86
87
87
while iteration. changed ( ) {
88
88
// output(K1, V1 * 100 + V2) :- input1(K1, V1), input2(K1, V2).
89
- output. from_join ( & input1, & input2, |& k1, & v1, & v2| ( k1, v1 * 100 + v2) ) ;
89
+ output. from_join ( & input1, & input2, |( k1, ) , v1, v2| ( k1, v1 * 100 + v2) ) ;
90
90
}
91
91
92
92
output. complete ( )
@@ -98,9 +98,9 @@ fn sum_join_via_relation(
98
98
input1_slice : & [ ( u32 , u32 ) ] ,
99
99
input2_slice : & [ ( u32 , u32 ) ] ,
100
100
) -> Relation < ( u32 , u32 ) > {
101
- let input1: Relation < _ > = input1_slice. iter ( ) . collect ( ) ;
102
- let input2: Relation < _ > = input2_slice. iter ( ) . collect ( ) ;
103
- Relation :: from_join ( & input1, & input2, |& k1, & v1, & v2| ( k1, v1 * 100 + v2) )
101
+ let input1: Relation < ( u32 , u32 ) > = input1_slice. iter ( ) . collect ( ) ;
102
+ let input2: Relation < ( u32 , u32 ) > = input2_slice. iter ( ) . collect ( ) ;
103
+ Relation :: from_join ( & input1, & input2, |( k1, ) , v1, v2| ( k1, v1 * 100 + v2) )
104
104
}
105
105
106
106
proptest ! {
@@ -183,7 +183,7 @@ fn leapjoin_from_extend() {
183
183
while iteration. changed ( ) {
184
184
variable. from_leapjoin (
185
185
& variable,
186
- doubles. extend_with ( |& ( i, _) | i ) ,
186
+ doubles. extend_with ( |& ( i, _) | ( i , ) ) ,
187
187
|& ( i, _) , & j| ( i, j) ,
188
188
) ;
189
189
}
@@ -221,11 +221,11 @@ fn passthrough_leaper() {
221
221
222
222
#[ test]
223
223
fn relation_from_antijoin ( ) {
224
- let lhs: Relation < _ > = ( 0 .. 10 ) . map ( |x| ( x, x) ) . collect ( ) ;
225
- let rhs: Relation < _ > = ( 0 .. 10 ) . filter ( |x| x % 2 == 0 ) . collect ( ) ;
224
+ let lhs: Relation < ( u32 , u32 ) > = ( 0 .. 10 ) . map ( |x| ( x, x) ) . collect ( ) ;
225
+ let rhs: Relation < ( u32 , ) > = ( 0 .. 10 ) . filter ( |x| x % 2 == 0 ) . map ( |x| ( x , ) ) . collect ( ) ;
226
226
let expected: Relation < _ > = ( 0 .. 10 ) . filter ( |x| x % 2 == 1 ) . map ( |x| ( x, x) ) . collect ( ) ;
227
227
228
- let result = Relation :: from_antijoin ( & lhs, & rhs, |a , b| ( * a , * b ) ) ;
228
+ let result = Relation :: from_antijoin ( & lhs, & rhs, |x| x ) ;
229
229
230
230
assert_eq ! ( result. elements, expected. elements) ;
231
231
}
0 commit comments