Created
August 13, 2020 04:59
-
-
Save bigs/e03beabb6c412e9ba423c7f519c62b85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Data.Matrix | |
Matrix : (m: Nat) -> (n: Nat) -> (a: Type) -> Type | |
Matrix m n a = Vect m (Vect n a) | |
madd : Num a => {n : _} -> Matrix m n a -> Matrix m n a -> Matrix m n a | |
madd [] [] = [] | |
madd (x :: xs) (y :: ys) = vadd {n=n} x y :: madd xs ys | |
where | |
vadd : {n : _} -> Vect n a -> Vect n a -> Vect n a | |
vadd {n=Z} [] [] = [] | |
vadd {n=(S pred)} (vx :: vxs) (vy :: vys) = (vx + vy) :: vadd {n=pred} vxs vys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment