summaryrefslogtreecommitdiff
path: root/transfer/lib/list.tr
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2005-11-30 16:00:06 +0000
committerbringert <bringert@cs.chalmers.se>2005-11-30 16:00:06 +0000
commitcba2fcb9b118cedb603b171ac7d7581c5adb844c (patch)
tree5f777207338134402d07486d334dcc764d933027 /transfer/lib/list.tr
parent86df2a69b149c1f4ff2cb9139447f5a6faccd483 (diff)
Moved transfer libraries to transfer/lib
Diffstat (limited to 'transfer/lib/list.tr')
-rw-r--r--transfer/lib/list.tr17
1 files changed, 17 insertions, 0 deletions
diff --git a/transfer/lib/list.tr b/transfer/lib/list.tr
new file mode 100644
index 000000000..079208167
--- /dev/null
+++ b/transfer/lib/list.tr
@@ -0,0 +1,17 @@
+import nat
+
+data List : (_:Type) -> Type where
+ Nil : (A:Type) -> List A
+ Cons : (A:Type) -> A -> List A -> List A
+
+size : (A:Type) -> List A -> Nat
+size _ (Nil _) = Zero
+size A (Cons _ x xs) = Succ (size A xs)
+
+map : (A:Type) -> (B:Type) -> (A -> B) -> List A -> List B
+map _ B _ (Nil _) = Nil B
+map A B f (Cons _ x xs) = Cons B (f x) (map A B f xs)
+
+append : (A:Type) -> (xs:List A) -> List A -> List A
+append _ (Nil _) ys = ys
+append A (Cons _ x xs) ys = Cons A x (append A xs ys)