Mercurial > urweb
annotate demo/nested.ur @ 956:d80734855790
Don't try to check if functions are already tail-recursive
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 17 Sep 2009 17:17:49 -0400 |
parents | d4a81273d4b1 |
children |
rev | line source |
---|---|
adamc@455 | 1 fun pageA () = return <xml> |
adamc@455 | 2 <head> |
adamc@455 | 3 <title>A</title> |
adamc@455 | 4 </head> |
adamc@455 | 5 <body> |
adamc@455 | 6 <form> |
adamc@455 | 7 <table> |
adamc@455 | 8 <tr> |
adamc@455 | 9 <td>Forename:</td> |
adamc@455 | 10 <td><textbox{#Forename}/></td> |
adamc@455 | 11 </tr> |
adamc@455 | 12 <tr> |
adamc@455 | 13 <td>Enter a Surname?</td> |
adamc@455 | 14 <td><checkbox{#EnterSurname}/></td> |
adamc@455 | 15 </tr> |
adamc@455 | 16 </table> |
adamc@455 | 17 <submit action={fromA} /> |
adamc@455 | 18 </form> |
adamc@455 | 19 </body> |
adamc@455 | 20 </xml> |
adamc@455 | 21 |
adamc@455 | 22 and fromA r = |
adamc@455 | 23 let |
adamc@455 | 24 val forename = r.Forename |
adamc@455 | 25 |
adamc@455 | 26 fun pageB () = return <xml> |
adamc@455 | 27 <head> |
adamc@455 | 28 <title>B</title> |
adamc@455 | 29 </head> |
adamc@455 | 30 <body> |
adamc@455 | 31 <form> |
adamc@455 | 32 Surname: |
adamc@455 | 33 <textbox{#Surname}/> |
adamc@455 | 34 <submit action={pageC'} /> |
adamc@455 | 35 </form> |
adamc@455 | 36 <a link={pageA ()}>Previous</a> |
adamc@455 | 37 </body> |
adamc@455 | 38 </xml> |
adamc@455 | 39 |
adamc@455 | 40 and pageC' r = pageC (Some r.Surname) |
adamc@455 | 41 |
adamc@455 | 42 and pageC surname = return <xml> |
adamc@455 | 43 <head> |
adamc@455 | 44 <title>C</title> |
adamc@455 | 45 </head> |
adamc@455 | 46 <body> |
adamc@455 | 47 <p>Hello {[forename]}{case surname of |
adamc@455 | 48 None => <xml/> |
adamc@455 | 49 | Some s => <xml> {[s]}</xml>}</p> |
adamc@455 | 50 {case surname of |
adamc@455 | 51 None => <xml><a link={pageA ()}>Previous</a></xml> |
adamc@455 | 52 | Some _ => <xml><a link={pageB ()}>Previous</a></xml>} |
adamc@455 | 53 </body> |
adamc@455 | 54 </xml> |
adamc@455 | 55 in |
adamc@455 | 56 if r.EnterSurname then |
adamc@455 | 57 pageB () |
adamc@455 | 58 else |
adamc@455 | 59 pageC None |
adamc@455 | 60 end |
adamc@455 | 61 |
adamc@455 | 62 val main = pageA |