comparison tests/relops.ur @ 260:645d0e8da643

Monoize relops
author Adam Chlipala <adamc@hcoop.net>
date Sun, 31 Aug 2008 15:47:32 -0400
parents 71bafe66dbe1
children e933297c4e24
comparison
equal deleted inserted replaced
259:d1b679dbbc25 260:645d0e8da643
5 UNION SELECT * FROM t1) 5 UNION SELECT * FROM t1)
6 val q2 = (SELECT t1.A, t1.B FROM t1 WHERE t1.A = 0 6 val q2 = (SELECT t1.A, t1.B FROM t1 WHERE t1.A = 0
7 INTERSECT SELECT t1.B, t1.A FROM t1 WHERE t1.B = t1.B) 7 INTERSECT SELECT t1.B, t1.A FROM t1 WHERE t1.B = t1.B)
8 val q3 = (SELECT t1.A, t1.B, t1.C FROM t1 WHERE t1.A = 0 8 val q3 = (SELECT t1.A, t1.B, t1.C FROM t1 WHERE t1.A = 0
9 INTERSECT SELECT * FROM t1 WHERE t1.B = 'Hello world!' 9 INTERSECT SELECT * FROM t1 WHERE t1.B = 'Hello world!'
10 EXCEPT SELECT * FROM t1 WHERE t1.A < t1.A) 10 EXCEPT SELECT * FROM t1 WHERE t1.A < t1.A
11 UNION SELECT * FROM t1 WHERE t1.A > t1.A)
12
13 datatype list a = Nil | Cons of a * list a
14
15 val r1 : transaction (list {A : int, B : string, C : float}) =
16 query q3
17 (fn fs acc => return (Cons (fs.T1, acc)))
18 Nil
19
20 val r2 : transaction string =
21 ls <- r1;
22 return (case ls of
23 Nil => "Problem"
24 | Cons ({B = b, ...}, _) => b)
25
26 val main : unit -> transaction page = fn () =>
27 s <- r2;
28 return <html><body>
29 {cdata s}
30 </body></html>