Skip to content

Commit

Permalink
Transition back to JS Table
Browse files Browse the repository at this point in the history
Now passes unit tests with the true JS implementation of Table, as
opposed to only passing with the temporary NaiveTable module.  A few
Table.js bugs were fixed.
  • Loading branch information
exists-forall committed Mar 31, 2016
1 parent 5b63333 commit 2ca2ceb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/CustomArray.elm
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ module CustomArray

import Bitwise

--import Table exposing (Table)
import NaiveTable as Table exposing (Table)
import Table exposing (Table)
import Assume exposing (assumeJust)
import ListUtils
import TupleUtils
Expand Down
9 changes: 6 additions & 3 deletions src/Native/Table.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Elm.Native.Table = {};
Elm.Native.Table.make = function(localRuntime) {

localRuntime.Native = localRuntime.Native || {};
localRuntime.Native.Table = localRuntime.Native.Table || {};
if (localRuntime.Native.Table.values)
Expand Down Expand Up @@ -93,6 +92,10 @@ Elm.Native.Table.make = function(localRuntime) {

function initialize(f, len)
{
if (len <= 0) {
return [];
}

var result = new Array(len);

for (var i = 0; i < len; ++i)
Expand Down Expand Up @@ -162,7 +165,7 @@ Elm.Native.Table.make = function(localRuntime) {
// TODO: This can definitely be rewritten in terms of initialize
function append(table1, table2)
{
return table.concat(table2);
return table1.concat(table2);
}

function get(i, table)
Expand Down Expand Up @@ -358,7 +361,7 @@ Elm.Native.Table.make = function(localRuntime) {

length: length,

map: map,
map: F2(map),
foldl: F3(foldl),
foldr: F3(foldr),
mapAccumL: F3(mapAccumL),
Expand Down

0 comments on commit 2ca2ceb

Please sign in to comment.