Skip to content

Instantly share code, notes, and snippets.

@ArpegiusWhooves
Created June 12, 2019 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArpegiusWhooves/e31abc1e404b68e283149b89b004d732 to your computer and use it in GitHub Desktop.
Save ArpegiusWhooves/e31abc1e404b68e283149b89b004d732 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/yegolit
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
"use strict";
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
var cartesian = function cartesian(_x, _x2) {
var _arguments = arguments;
var _again = true;
_function: while (_again) {
var a = _x,
b = _x2;
_ref = _len = c = _key = undefined;
for (var _len = _arguments.length, c = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
c[_key - 2] = _arguments[_key];
}
var _ref;
_again = false;
if (b) {
_arguments = [(_ref = []).concat.apply(_ref, _toConsumableArray(a.map(function (a) {
return b.map(function (b) {
return [].concat(a, b);
});
})))].concat(c);
_x = _arguments[0];
_x2 = _arguments[1];
_again = true;
continue _function;
} else {
return a;
}
}
};
var range = function range(x) {
return [].concat(_toConsumableArray(Array(x).keys()));
};
var f = function f(x) {
return x[0] + "[0x" + x[2].toString(16) + "]=" + x[1];
};
var t = cartesian([["x", 1], ["y", 2], ["z", 3]], range(16));
/*var myWindow = window.open("", "MsgWindow", "width=300,height=500");
myWindow. */document.write(t.map(f).join("<br/>"));
</script>
<script id="jsbin-source-javascript" type="text/javascript">let cartesian = (a, b, ...c) => b ? cartesian([].concat(...a.map(a => b.map(b => [].concat(a, b)))), ...c) : a;
let range = (x) => [...Array(x).keys()];
var f= (x) =>`${x[0]}[0x${x[2].toString(16)}]=${x[1]}`;
var t= cartesian([["x",1],["y",2],["z",3]],range(16));
/*var myWindow = window.open("", "MsgWindow", "width=300,height=500");
myWindow. */document.write(t.map(f).join("<br/>"));</script></body>
</html>
"use strict";
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
var cartesian = function cartesian(_x, _x2) {
var _arguments = arguments;
var _again = true;
_function: while (_again) {
var a = _x,
b = _x2;
_ref = _len = c = _key = undefined;
for (var _len = _arguments.length, c = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
c[_key - 2] = _arguments[_key];
}
var _ref;
_again = false;
if (b) {
_arguments = [(_ref = []).concat.apply(_ref, _toConsumableArray(a.map(function (a) {
return b.map(function (b) {
return [].concat(a, b);
});
})))].concat(c);
_x = _arguments[0];
_x2 = _arguments[1];
_again = true;
continue _function;
} else {
return a;
}
}
};
var range = function range(x) {
return [].concat(_toConsumableArray(Array(x).keys()));
};
var f = function f(x) {
return x[0] + "[0x" + x[2].toString(16) + "]=" + x[1];
};
var t = cartesian([["x", 1], ["y", 2], ["z", 3]], range(16));
/*var myWindow = window.open("", "MsgWindow", "width=300,height=500");
myWindow. */document.write(t.map(f).join("<br/>"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment