Mercurial > urweb
annotate tests/megaform.ur @ 983:2cd8c1aa0d3a
Add tail call optimization to interpretation
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 24 Sep 2009 15:45:37 -0400 |
parents | 21f6d2e65685 |
children |
rev | line source |
---|---|
adamc@760 | 1 fun handler'' ls = |
adamc@760 | 2 case ls of |
adamc@760 | 3 Nil => <xml/> |
adamc@760 | 4 | Cons (r, ls) => <xml><li>{[r.C]}</li>{handler'' ls}</xml> |
adamc@760 | 5 |
adamc@760 | 6 fun handler' ls = |
adamc@760 | 7 case ls of |
adamc@760 | 8 Nil => <xml/> |
adamc@760 | 9 | Cons (r, ls) => <xml><li>{[r.Sub.A]} <ul>{handler'' r.Sub.Sub2}</ul></li>{handler' ls}</xml> |
adamc@760 | 10 |
adamc@760 | 11 fun handler r = return <xml><body> |
adamc@760 | 12 {[r.A]} |
adamc@760 | 13 <ul>{handler' r.Sub}</ul> |
adamc@760 | 14 {[r.C]}<br/> |
adamc@760 | 15 {[r.Sub2.A]}<br/> |
adamc@760 | 16 {handler'' r.Sub2.Nested} |
adamc@760 | 17 </body></xml> |
adamc@760 | 18 |
adamc@760 | 19 fun main () = return <xml><body> |
adamc@760 | 20 <form> |
adamc@760 | 21 <textbox{#A}/><br/> |
adamc@760 | 22 <subforms{#Sub}> |
adamc@760 | 23 <entry> |
adamc@760 | 24 <subform{#Sub}> |
adamc@760 | 25 <textbox{#A}/><br/> |
adamc@760 | 26 <subforms{#Sub2}> |
adamc@760 | 27 <entry> |
adamc@760 | 28 <textbox{#C}/><br/> |
adamc@760 | 29 </entry> |
adamc@760 | 30 |
adamc@760 | 31 <entry> |
adamc@760 | 32 <textbox{#C}/><br/> |
adamc@760 | 33 </entry> |
adamc@760 | 34 </subforms> |
adamc@760 | 35 </subform> |
adamc@760 | 36 </entry> |
adamc@760 | 37 |
adamc@760 | 38 <entry> |
adamc@760 | 39 <subform{#Sub}> |
adamc@760 | 40 <textbox{#A}/><br/> |
adamc@760 | 41 <subforms{#Sub2}> |
adamc@760 | 42 <entry> |
adamc@760 | 43 <textbox{#C}/><br/> |
adamc@760 | 44 </entry> |
adamc@760 | 45 |
adamc@760 | 46 <entry> |
adamc@760 | 47 <textbox{#C}/><br/> |
adamc@760 | 48 </entry> |
adamc@760 | 49 </subforms> |
adamc@760 | 50 </subform> |
adamc@760 | 51 </entry> |
adamc@760 | 52 </subforms> |
adamc@760 | 53 <textbox{#C}/><br/> |
adamc@760 | 54 |
adamc@760 | 55 <subform{#Sub2}> |
adamc@760 | 56 <textbox{#A}/><br/> |
adamc@760 | 57 |
adamc@760 | 58 <subforms{#Nested}> |
adamc@760 | 59 <entry> |
adamc@760 | 60 <textbox{#C}/> |
adamc@760 | 61 </entry> |
adamc@760 | 62 </subforms> |
adamc@760 | 63 </subform><br/> |
adamc@760 | 64 |
adamc@760 | 65 <submit action={handler}/> |
adamc@760 | 66 </form> |
adamc@760 | 67 </body></xml> |