Mercurial > urweb
comparison demo/tcSum.ur @ 417:e0e9e9eca1cb
Fix nasty de Bruijn substitution bug; TcSum demo
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 23 Oct 2008 12:58:35 -0400 |
parents | |
children | 6c4643880df5 |
comparison
equal
deleted
inserted
replaced
416:679b2fbbd4d0 | 417:e0e9e9eca1cb |
---|---|
1 fun sum (t ::: Type) (_ : num t) (fs ::: {Unit}) (x : $(mapUT t fs)) = | |
2 foldUR [t] [fn _ => t] | |
3 (fn (nm :: Name) (rest :: {Unit}) [[nm] ~ rest] n acc => n + acc) | |
4 zero [fs] x | |
5 | |
6 fun main () = return <xml><body> | |
7 {[sum {A = 0, B = 1}]}<br/> | |
8 {[sum {C = 2.1, D = 3.2, E = 4.3}]} | |
9 </body></xml> |