From d906071e316e197d9b1dd0f6b05ba80f8dc79ce8 Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Sat, 11 Jan 2020 19:15:17 -0500 Subject: [PATCH] get rid of fromDimensions --- src/Grid.elm | 23 +---------------------- src/Wave.elm | 3 ++- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/src/Grid.elm b/src/Grid.elm index 7b7c3ba..c4946fa 100644 --- a/src/Grid.elm +++ b/src/Grid.elm @@ -1,4 +1,4 @@ -module Grid exposing (FromRowsAndColumnsProblem, Grid, fromDimensions, fromRowsAndColumns, fromRowsAndColumnsArray, get, getWrapping, indexedMap, initialize, map, rotate, set, toArrays, topLeft, update, view, windows) +module Grid exposing (FromRowsAndColumnsProblem, Grid, fromRowsAndColumns, fromRowsAndColumnsArray, get, getWrapping, indexedMap, initialize, map, rotate, set, toArrays, topLeft, update, view, windows) import Array exposing (Array) import Color.Transparent as Color exposing (Color) @@ -30,27 +30,6 @@ initialize { rows, columns } init = } -{-| TODO remove this or initialize --} -fromDimensions : ({ row : Int, column : Int } -> a) -> { rows : Int, columns : Int } -> Grid a -fromDimensions initter { rows, columns } = - Grid - { width = columns - , height = rows - , items = - Array.initialize rows - (\rowNum -> - Array.initialize columns - (\colNum -> - initter - { row = rowNum - , column = colNum - } - ) - ) - } - - {-| Construct a grid from a list of lists. The outer list is a list of rows, and the inner lists are values in columns. diff --git a/src/Wave.elm b/src/Wave.elm index f8a5c70..6db6396 100644 --- a/src/Wave.elm +++ b/src/Wave.elm @@ -74,10 +74,11 @@ init rules weights dimensions = |> Heap.thenBy (.coords >> .column) ) , items = - Grid.fromDimensions (always initialCell) + Grid.initialize { rows = dimensions.height , columns = dimensions.width } + (always initialCell) }