annotate demo/subforms.ur @ 1863:32784d27b5bc

Expand coverage of 'functionInside' for Especialize
author Adam Chlipala <adam@chlipala.net>
date Sat, 10 Aug 2013 10:13:40 -0400
parents be0c4e2e488a
children
rev   line source
adamc@780 1 fun sub r =
adamc@780 2 let
adamc@780 3 fun sub' ls =
adamc@780 4 case ls of
adamc@780 5 [] => <xml/>
adamc@780 6 | r :: ls => <xml>
adamc@780 7 <li>{[r.Num]} = {[r.Text]}</li>
adamc@780 8 {sub' ls}
adamc@780 9 </xml>
adamc@780 10 in
adamc@780 11 return <xml><body>
adamc@780 12 {sub' r.Lines}
adamc@780 13 </body></xml>
adamc@780 14 end
adamc@780 15
adam@1833 16 fun subfrms n =
adamc@780 17 if n <= 0 then
adamc@780 18 <xml/>
adamc@780 19 else
adamc@780 20 <xml>
adamc@780 21 <entry>
adamc@780 22 <hidden{#Num} value={show n}/>
adamc@780 23 <li>{[n]}: <textbox{#Text}/></li>
adamc@780 24 </entry>
adam@1833 25 {subfrms (n - 1)}
adamc@780 26 </xml>
adamc@780 27
adamc@780 28 fun form n = return <xml><body>
adamc@780 29 <form>
adamc@780 30 <subforms{#Lines}>
adam@1833 31 {subfrms n}
adamc@780 32 </subforms>
adamc@780 33 <submit action={sub}/>
adamc@780 34 </form>
adamc@780 35
adamc@780 36 <a link={form (n + 1)}>One more blank</a><br/>
adamc@780 37 {if n > 0 then
adamc@780 38 <xml><a link={form (n - 1)}>One fewer blank</a></xml>
adamc@780 39 else
adamc@780 40 <xml/>}
adamc@780 41 </body></xml>
adamc@780 42
adamc@780 43 fun main () = form 1