2011-12-31 20:55:21 +04:00
|
|
|
|
2013-07-27 17:32:05 +04:00
|
|
|
intVec : Vect 5 Int
|
2012-01-07 03:20:03 +04:00
|
|
|
intVec = [1, 2, 3, 4, 5]
|
2011-12-31 20:55:21 +04:00
|
|
|
|
2012-01-07 03:20:03 +04:00
|
|
|
double : Int -> Int
|
|
|
|
double x = x * 2
|
2011-12-31 20:55:21 +04:00
|
|
|
|
2013-07-27 17:32:05 +04:00
|
|
|
vec : (n ** Vect n Int)
|
2012-01-07 03:20:03 +04:00
|
|
|
vec = (_ ** [3, 4])
|
2012-01-06 16:40:46 +04:00
|
|
|
|
2012-01-07 03:20:03 +04:00
|
|
|
list_lookup : Nat -> List a -> Maybe a
|
|
|
|
list_lookup _ Nil = Nothing
|
2013-07-26 23:05:47 +04:00
|
|
|
list_lookup Z (x :: xs) = Just x
|
2012-01-07 03:20:03 +04:00
|
|
|
list_lookup (S k) (x :: xs) = list_lookup k xs
|
2012-01-06 16:40:46 +04:00
|
|
|
|
2012-01-07 03:20:03 +04:00
|
|
|
lookup_default : Nat -> List a -> a -> a
|
2012-01-07 18:19:59 +04:00
|
|
|
lookup_default i xs def = case list_lookup i xs of
|
2012-01-06 16:40:46 +04:00
|
|
|
Nothing => def
|
2012-01-07 20:24:59 +04:00
|
|
|
Just x => x
|
2012-01-06 16:40:46 +04:00
|
|
|
|