diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-10-21 19:24:39 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-10-21 19:24:39 -0400 |
commit | 17b3f5af99c07d7361fb99124412aff1768cfe13 (patch) | |
tree | fcfbcfaf492be1aa13c484eea28cfedaf565ed6c /demo | |
parent | d66bb9f256db65e3487dec361a4a5a9d7ee238b0 (diff) |
Sum demo, minus inference of {Unit}s
Diffstat (limited to 'demo')
-rw-r--r-- | demo/link.ur | 2 | ||||
-rw-r--r-- | demo/sum.ur | 9 | ||||
-rw-r--r-- | demo/sum.urp | 2 | ||||
-rw-r--r-- | demo/sum.urs | 1 |
4 files changed, 13 insertions, 1 deletions
diff --git a/demo/link.ur b/demo/link.ur index f9e33968..122b98f1 100644 --- a/demo/link.ur +++ b/demo/link.ur @@ -3,5 +3,5 @@ fun target () = return <xml><body> </body></xml> fun main () = return <xml><body> - <a link={target ()}>Go there</a> + <a link={target}>Go there</a> </body></xml> diff --git a/demo/sum.ur b/demo/sum.ur new file mode 100644 index 00000000..96a45891 --- /dev/null +++ b/demo/sum.ur @@ -0,0 +1,9 @@ +fun sum (fs :: {Unit}) (x : $(mapUT int fs)) = + foldUR [int] [fn _ => int] + (fn (nm :: Name) (rest :: {Unit}) [[nm] ~ rest] n acc => n + acc) + 0 [fs] x + +fun main () = return <xml><body> + {[sum [[A, B]] {A = 0, B = 1}]}<br/> + {[sum [[C, D, E]] {C = 2, D = 3, E = 4}]} +</body></xml> diff --git a/demo/sum.urp b/demo/sum.urp new file mode 100644 index 00000000..e872a81b --- /dev/null +++ b/demo/sum.urp @@ -0,0 +1,2 @@ + +sum diff --git a/demo/sum.urs b/demo/sum.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/demo/sum.urs @@ -0,0 +1 @@ +val main : unit -> transaction page |