function isInt(n) {
	return Number(n) === n && n % 1 === 0;
}

function create_map(n, func) {
	var result = [];
	var i;
	for (i = 0; i < n; ++i) {
		result.push(func(i));
	}
	return result;
}

function create_matrix(n, m, func) {
	var i, j;
	var result = create_map(n, function(i) {
		return create_map(m, function (j) {
			return func(i, j);
		});
	});
	result.width = m;
	result.height = n;
	result.forEach = function (callback, thisArg) {
		var that = thisArg || this;
		for (i = 0; i < result.height; ++i) {
			for (j = 0; j < result.width; ++j) {
				callback(that[i][j], i, j, that);
			}
		}
	};
	return result;
}

function copy_matrix(matr) {
	var i, j;
	var result = [];
	result.width  = matr.width;
	result.height = matr.height;
	for (i = 0; i < matr.height; ++i) {
		result[i] = [];
		for (j = 0; j < matr.width; ++j) {
			result[i][j] = matr[i][j];
		}
	}
	result.matrForEach = matr.matrForEach;
	return result;
}

function copy_matrix_wo_col(matr, col) {
	return create_matrix(matr.height, matr.width - 1, function(i, j) {
		return j < col ? matr[i][j] : matr[i][j+1];
	});
}

function copy_matrix_wo_row(matr, row) {
	return create_matrix(matr.height - 1, matr.width, function(i, j) {
		return i < row ? matr[i][j] : matr[i+1][j];
	});
}

function cr_const(n) {
	return function() {
		return n;
	};
}

@@ -52,24 +52,420 @@
 1 === 0;%0A%7D%0A%0A
+var fact_arr = %5B1, 1%5D;%0Afunction factorial(n) %7B%0A%09for (var i = 2; i %3C= n; ++i) %7B%0A%09%09fact_arr%5Bi%5D = i * fact_arr%5Bi-1%5D;%0A%09%7D%0A%09return fact_arr%5Bn%5D;%0A%7D%0A%0Afunction permutation(arr, n) %7B%0A%09var perm = %5B%5D;%0A%09var rest = arr.slice();%0A%09for (var i = 0; i %3C arr.length; ++i) %7B%0A%09%09var f = factorial(arr.length - i - 1);%0A%09%09var pos = Math.floor(n / f);%0A%09%09n = n %25 f;%0A%09%09perm.push(rest.splice(pos, 1)%5B0%5D);%0A%09%7D%0A%0A%09return perm;%0A%7D%0A%0A
 function cre

Add more utility functions