diff options
Diffstat (limited to 'demo/sum.ur')
-rw-r--r-- | demo/sum.ur | 9 |
1 files changed, 9 insertions, 0 deletions
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> |