comparison tests/each.ur @ 1355:ccf1d445b794

Hopeful fix to stop Especialize infinite looping
author Adam Chlipala <adam@chlipala.net>
date Tue, 21 Dec 2010 13:57:12 -0500
parents
children
comparison
equal deleted inserted replaced
1354:1b286f2309bc 1355:ccf1d445b794
1 sequence s
2 table t : { Id : int, S1 : string, S2:string, S3:string, S4:string }
3
4 fun each (n : int, (f : unit -> transaction unit)) = if n > 0 then f (); each ((n-1),f) else return ()
5
6 fun fill () =
7 dml (DELETE FROM t WHERE 1=1);
8 each (1,( fn () =>
9 (nv <- nextval s;
10 (dml (INSERT INTO t (Id, S1, S2, S3, S4) VALUES ({[nv]}, {["S1"]}, {["S2"]}, {["S3"]}, {["S4"]}))))
11 ));
12 return <xml>done</xml>
13
14 fun main () = return <xml><body>
15 <form><submit action={fill} value="fill"/></form>
16 </body></xml>