Skip to content

Commit

Permalink
Rename Matrix.createMatrix to Matrix.repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
TimonVS committed May 22, 2019
1 parent ad90419 commit b8a5f23
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type alias Model =

init : () -> ( Model, Cmd msg )
init _ =
( Model (Matrix.createMatrix 50 50 ( Nothing, None )) (Time.millisToPosix 0), Cmd.none )
( Model (Matrix.repeat 50 50 ( Nothing, None )) (Time.millisToPosix 0), Cmd.none )



Expand Down
6 changes: 3 additions & 3 deletions src/Matrix.elm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Matrix exposing (Matrix, Point, createMatrix, mapCells)
module Matrix exposing (Matrix, Point, mapCells, repeat)


type alias Matrix a =
Expand All @@ -9,8 +9,8 @@ type alias Point =
( Int, Int )


createMatrix : Int -> Int -> a -> Matrix a
createMatrix width height initialValue =
repeat : Int -> Int -> a -> Matrix a
repeat width height initialValue =
List.repeat height (List.repeat width initialValue)


Expand Down
4 changes: 2 additions & 2 deletions tests/MainTests.elm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ suite =
\_ ->
let
grid =
Matrix.createMatrix 3 3 ( Nothing, None )
Matrix.repeat 3 3 ( Nothing, None )
in
incrementCells ( 0, 0 ) grid
|> Expect.equal
Expand All @@ -27,7 +27,7 @@ suite =
\_ ->
let
grid =
Matrix.createMatrix 3 3 ( Nothing, None )
Matrix.repeat 3 3 ( Nothing, None )
in
incrementCells ( 0, 0 ) grid
|> incrementCells ( 1, 1 )
Expand Down
6 changes: 3 additions & 3 deletions tests/MatrixTests.elm
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module MatrixTests exposing (suite)

import Expect
import Matrix exposing (createMatrix)
import Matrix
import Test exposing (..)


suite : Test
suite =
describe "The Matrix module"
[ describe "createMatrix"
[ describe "Matrix.repeat"
[ test "create matrix of 3x3" <|
\_ ->
createMatrix 3 3 -1
Matrix.repeat 3 3 -1
|> Expect.equal
[ [ -1, -1, -1 ]
, [ -1, -1, -1 ]
Expand Down

0 comments on commit b8a5f23

Please sign in to comment.