How to use the xprod function from ramda

Find comprehensive JavaScript ramda.xprod code examples handpicked from public code repositorys.

312
313
314
315
316
317
318
319
320
321
  out.index = index;
  return out;
});
// debugOuts(outs);
// get product of all inputs and outputs and check if before settlement height
const pairs = xprod(inputAddresses, outs);
let dups = {};
// debug(`checking ${pairs.length} pairs of input+output for being settled TX`)
if (pairs && Array.isArray(pairs)) {
  // all combinations of input.address + output.address are being checked, if is before settlement and found, lets add this marked TX
fork icon12
star icon5
watch icon7

147
148
149
150
151
152
153
154
155
156
157
  })
})


describe('squareIndex', () => {
  // top row
  R.xprod(_.range(9), _.range(3)).map(
    ([columnIndex, rowIndex]) => it(
      `${columnIndex}, ${rowIndex} should be ${Math.floor(columnIndex / 3)}`,
      () => assert.equal(
        squareIndex(columnIndex, rowIndex),
fork icon1
star icon0
watch icon0

+ 2 other calls in file

5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
 * @param {Array} bs The second list.
 * @return {Array} The list made by combining each possible pair from
 *         `as` and `bs` into pairs (`[a, b]`).
 * @example
 *
 *      R.xprod([1, 2], ['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]
 */
// = xprodWith(prepend); (takes about 3 times as long...)
var xprod = _curry2(function xprod(a, b) {
    // = xprodWith(prepend); (takes about 3 times as long...)
fork icon0
star icon0
watch icon0

+ 17 other calls in file

33
34
35
36
37
38
39
40
41
42
43
44


console.log(deterministicGame(startPos));


const possibleSeqs = R.map(
    R.compose(R.sum, R.unnest),
    R.xprod(R.xprod([1, 2, 3], [1, 2, 3]), [1, 2, 3]));
const quantumGame = R.memoizeWith(
    R.unapply(R.toString),
    ([p1, p2], [p1Score, p2Score]) => {
      p1 %= 10; p2 %= 10;
fork icon0
star icon0
watch icon0

+ 6 other calls in file

15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
 * @return {Array} The list made by combining each possible pair from
 *         `as` and `bs` into pairs (`[a, b]`).
 * @example
 *
 *      R.xprod([1, 2], ['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]
 * @symb R.xprod([a, b], [c, d]) = [[a, c], [a, d], [b, c], [b, d]]
 */




var xprod =
fork icon0
star icon0
watch icon2

+ 7 other calls in file

17
18
19
20
21
22
23
24
25
26
27
28
console.log(checksum);


const evenQuot = R.compose(
    R.apply(R.divide), R.nth(0),
    R.filter(([a, b]) => a > b && a % b === 0),
    (row) => R.xprod(row, row));


const result = R.compose(
    R.sum,
    R.map(evenQuot))(rows);
fork icon0
star icon0
watch icon0

Other functions in ramda

Sorted by popularity

function icon

ramda.clone is the most popular function in ramda (30311 examples)