<commit_before>import Immutable from 'immutable';
import { TILE_SET_TEXTURE, TILE_SET_PROPERTY } from '../actions/tiles';

const initialState = Immutable.List();

function set(mat, x, y, k, v) {
  var xs = mat;
  if (!xs.has(x)) {
    xs = xs.set(x, Immutable.List());
  }

  var ys = xs.get(x);
  var cell = ys.get(y) || {};
  cell[k] = v;

  ys = ys.set(y, cell);
  xs = xs.set(x, ys);

  return xs;<commit_msg>fix bug where some rows or cells could be undefined<commit_after>import Immutable from 'immutable';
import { TILE_SET_TEXTURE, TILE_SET_PROPERTY } from '../actions/tiles';

const initialState = Immutable.List();

function set(mat, x, y, k, v) {
  var xs = mat;
  var ys = xs.get(x) || Immutable.List();
  var cell = ys.get(y) || {};
  cell[k] = v;

  ys = ys.set(y, cell);
  xs = xs.set(x, ys);

  return xs;
{'fraction_non_alphanumeric': 0.1753958587088916, 'fraction_numerical': 0.0, 'mean_word_length': 3.4918032786885247, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7030407', 'n_tokens_mistral': 346, 'n_tokens_neox': 327, 'n_words': 88}