Functional JS with Ramda's xprod

Replace imperative style filtering iterations with data set operations (like difference)

HTML

<script src="https://rawgithub.com/CrossEye/ramda/master/ramda.js"></script>
<pre><code id="output"></code></pre>

JavaScript

ramda.installTo(this);

/// The Question: see http://stackoverflow.com/q/20617819
// find every missing x, y value beginning at  [1, 1] and ending at, say, 1 more than the largest value in coords ([4, 5])

/// given
var coords = [
    [2, 2],
    [2, 4],
    [3, 2],
    [3, 4]
];

//=================== actual code ===============================

/// are two coordinates equal ?
var pairEq = and(eqProps(0), eqProps(1));

/// all possible combinations
var allCoordinates = xprod(
	range(1, 2 + max(pluck(0, coords))),
	range(1, 2 + max(pluck(1, coords)))
);

var missing = differenceWith(pairEq, allCoordinates, coords);

//===============================================================


//=================== just display ==============================

var log = (function() {
    var o = document.getElementById("output");
    return function() {o.innerHTML += "\n" + [].join.call(arguments, ", ");}
}());

log(map(function(pair) {
    return "(" + pair[0] + ", " + pair[1] + ")";
}, missing).join("\n"));

//===============================================================