summaryrefslogtreecommitdiff
path: root/demo
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-02-22 17:39:55 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-02-22 17:39:55 -0500
commitadcf93304e6fc100d0e714a898033d2a9033173c (patch)
treea2766814d1fec880c763910917d1e4771455320a /demo
parent1f7d0c20ae30c11cdc64a2c2fc90f15cdf02c34b (diff)
demo/sum working with manual folders
Diffstat (limited to 'demo')
-rw-r--r--demo/sum.ur10
1 files changed, 5 insertions, 5 deletions
diff --git a/demo/sum.ur b/demo/sum.ur
index 9391637a..566b7899 100644
--- a/demo/sum.ur
+++ b/demo/sum.ur
@@ -1,10 +1,10 @@
-fun sum (fs ::: {Unit}) (x : $(mapUT int fs)) =
+fun sum (fs ::: {Unit}) (fold : folder fs) (x : $(mapUT int fs)) =
foldUR [int] [fn _ => int]
(fn (nm :: Name) (rest :: {Unit}) [[nm] ~ rest] n acc => n + acc)
- 0 [fs] x
+ 0 [fs] fold x
fun main () = return <xml><body>
- {[sum {}]}<br/>
- {[sum {A = 0, B = 1}]}<br/>
- {[sum {C = 2, D = 3, E = 4}]}
+ {[sum Folder.nil {}]}<br/>
+ {[sum (Folder.cons [#A] [()] (Folder.cons [#B] [()] Folder.nil)) {A = 0, B = 1}]}<br/>
+ {[sum (Folder.cons [#D] [()] (Folder.cons [#C] [()] (Folder.cons [#E] [()] Folder.nil))) {C = 2, D = 3, E = 4}]}
</body></xml>