Skip to content

Commit

Permalink
Rename Matrix.mapCells to Matrix.map
Browse files Browse the repository at this point in the history
  • Loading branch information
TimonVS committed May 22, 2019
1 parent b8a5f23 commit e92a424
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Fibonacci exposing (isFibonacci, isFibonacciSequence, isNextFibonacci)
import Html exposing (Html, button, div, table, td, text, tr)
import Html.Attributes exposing (class, style)
import Html.Events exposing (onClick)
import Matrix exposing (Matrix, Point, mapCells)
import Matrix exposing (Matrix, Point)
import Maybe
import Task
import Time
Expand Down Expand Up @@ -104,7 +104,7 @@ type Msg

incrementCells : Point -> Grid -> Grid
incrementCells ( x, y ) matrix =
mapCells
Matrix.map
(\cell ( colIndex, rowIndex ) ->
case cell of
( Just value, flag ) ->
Expand Down Expand Up @@ -147,7 +147,7 @@ lightUpFibonacciSequences grid =

resetFlags : Grid -> Grid
resetFlags matrix =
mapCells
Matrix.map
(\( value, flag ) _ ->
case ( value, flag ) of
( _, LightUpGreen ) ->
Expand Down
8 changes: 4 additions & 4 deletions src/Matrix.elm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Matrix exposing (Matrix, Point, mapCells, repeat)
module Matrix exposing (Matrix, Point, map, repeat)


type alias Matrix a =
Expand All @@ -14,8 +14,8 @@ repeat width height initialValue =
List.repeat height (List.repeat width initialValue)


mapCells : (a -> Point -> a) -> Matrix a -> Matrix a
mapCells fn matrix =
map : (a -> Point -> a) -> Matrix a -> Matrix a
map fn m =
List.indexedMap
(\rowIndex row ->
List.indexedMap
Expand All @@ -24,4 +24,4 @@ mapCells fn matrix =
)
row
)
matrix
m

0 comments on commit e92a424

Please sign in to comment.