From 68e812646fafd559b563e4e7174a6534a3bb4373 Mon Sep 17 00:00:00 2001 From: Rnhmjoj Date: Fri, 19 Dec 2014 20:28:32 +0100 Subject: [PATCH] Generalize empty matrix function --- Matrix.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Matrix.hs b/Matrix.hs index 17440d4..1c4983b 100644 --- a/Matrix.hs +++ b/Matrix.hs @@ -24,6 +24,6 @@ indeces :: Mat a -> Mat Pos indeces (Mat m) = Mat [[(x,y) | y <- [0..length (m !! x)-1]] | x <- [0..length m-1]] --- | Create a matrix of zeros -zeros :: Int -> Int -> Mat Int -zeros x y = Mat (replicate x $ replicate y 0) \ No newline at end of file +-- | Create a constant matrix +constant :: a -> Int -> Int -> Mat a +constant k x y = Mat (replicate x $ replicate y k) \ No newline at end of file