From dbe8e61acc616b8f5ac07e8df89eb98a7997c29d Mon Sep 17 00:00:00 2001 From: bringert Date: Fri, 25 Nov 2005 16:36:19 +0000 Subject: Move transfer into the GF repo. --- transfer/examples/array.tr | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 transfer/examples/array.tr (limited to 'transfer/examples/array.tr') diff --git a/transfer/examples/array.tr b/transfer/examples/array.tr new file mode 100644 index 000000000..7dcf6d443 --- /dev/null +++ b/transfer/examples/array.tr @@ -0,0 +1,10 @@ +import nat ; + +data Array : Type -> Nat -> Type where { + Empty : (A:Type) -> Array A Zero ; + Cell : (A:Type) -> (n:Nat) -> A -> Array A n -> Array A (Succ n) ; + } ; + +mapA : (A:Type) -> (B:Type) -> (n:Nat) -> (A -> B) -> Array A n -> Array B n ; +mapA A B _ f (Empty _) = Empty B ; +mapA A B (Succ n) f (Cell _ _ x xs) = Cell B n (f x) (mapA A B n f xs) ; -- cgit v1.2.3