utils/permutations.js
function cart(xs, ys)
{
	// nothing on the left
	if(!xs || xs.length === 0)
		return ys.map(function(y){
			return [[],y]
		});

	// nothing on the right
	if(!ys || ys.length === 0)
		return xs.map(function(x){
			return [x,[]]
		});

	return Combinatorics.cartesianProduct(x, y).toArray();
}
function cart(xs, ys)
{
	// nothing on the left
	if(!xs || xs.length === 0)
		return ys.map(function(y){
			return [[],y]
		});

	// nothing on the right
	if(!ys || ys.length === 0)
		return xs.map(function(x){
			return [x,[]]
		});

	return Combinatorics.cartesianProduct(x, y).toArray();
}
function cart ( xs , ys ) { // nothing on the left if ( ! xs || xs . length === 0 ) return ys . map ( function ( y ) { return [ [ ] , y ] } ) ; // nothing on the right if ( ! ys || ys . length === 0 ) return xs . map ( function ( x ) { return [ x , [ ] ] } ) ; return Combinatorics . cartesianProduct ( x , y ) . toArray ( ) ; }
save version of Combinatorics.cartesianProduct
save version of Combinatorics . cartesianProduct