From a2495d384c7747a079cb0f4bc31f44d626391068 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 23 Oct 2008 14:03:12 -0400 Subject: Metaform demos, minus prose --- demo/metaform.ur | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 demo/metaform.ur (limited to 'demo/metaform.ur') diff --git a/demo/metaform.ur b/demo/metaform.ur new file mode 100644 index 00000000..ae1197f4 --- /dev/null +++ b/demo/metaform.ur @@ -0,0 +1,28 @@ +functor Make (M : sig + con fs :: {Unit} + val names : $(mapUT string fs) + end) = struct + + fun handler values = return + {foldURX2 [string] [string] [body] + (fn (nm :: Name) (rest :: {Unit}) [[nm] ~ rest] name value => +
  • {[name]} = {[value]}
  • +
    ) + [M.fs] M.names values} +
    + + fun main () = return +
    + {foldUR [string] [fn cols :: {Unit} => xml form [] (mapUT string cols)] + (fn (nm :: Name) (rest :: {Unit}) [[nm] ~ rest] name + (acc : xml form [] (mapUT string rest)) => +
  • {[name]}:
  • + {useMore acc} +
    ) + + [M.fs] M.names} + + +
    + +end -- cgit v1.2.3