summaryrefslogtreecommitdiff
path: root/transfer/lib/array.tra
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2005-12-06 16:33:40 +0000
committerbringert <bringert@cs.chalmers.se>2005-12-06 16:33:40 +0000
commitc703a92136ce579282c63c6e31fff76cc84b37ce (patch)
treee0dedf8972756fa1322bb4d8a0c621a629bedc1e /transfer/lib/array.tra
parentee4adf5ba8ff50b4580a18d197f9e05d36195ede (diff)
Transfer: Changed transfer program file extension from .tr to .tra to avoid collision with Troff file extension.
Diffstat (limited to 'transfer/lib/array.tra')
-rw-r--r--transfer/lib/array.tra9
1 files changed, 9 insertions, 0 deletions
diff --git a/transfer/lib/array.tra b/transfer/lib/array.tra
new file mode 100644
index 000000000..e91fe35e7
--- /dev/null
+++ b/transfer/lib/array.tra
@@ -0,0 +1,9 @@
+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)