From fdc4582e7fbfaecebaa2d27660a0184d9949b232 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 14 May 2009 08:13:54 -0400 Subject: Improving/reordering Unpoly and Especialize; pathmaps --- lib/ur/list.ur | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lib/ur/list.ur (limited to 'lib/ur/list.ur') diff --git a/lib/ur/list.ur b/lib/ur/list.ur new file mode 100644 index 00000000..5310c810 --- /dev/null +++ b/lib/ur/list.ur @@ -0,0 +1,31 @@ +datatype t = datatype Basis.list + +val show (a ::: Type) (_ : show a) = + let + fun show' (ls : list a) = + case ls of + [] => "[]" + | x :: ls => show x ^ " :: " ^ show' ls + in + mkShow show' + end + +val rev (a ::: Type) = + let + fun rev' acc (ls : list a) = + case ls of + [] => acc + | x :: ls => rev' (x :: acc) ls + in + rev' [] + end + +fun mp (a ::: Type) (b ::: Type) f = + let + fun mp' acc ls = + case ls of + [] => rev acc + | x :: ls => mp' (f x :: acc) ls + in + mp' [] + end -- cgit v1.2.3