How to use the xprod function from ramda
Find comprehensive JavaScript ramda.xprod code examples handpicked from public code repositorys.
GitHub: trick77/bc-src
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
12
5
7
GitHub: bcrabbe/leetcode
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),
1
0
0
+ 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...)
0
0
0
+ 17 other calls in file
GitHub: jcla1/AdventOfCode
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;
0
0
0
+ 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 =
0
0
2
+ 7 other calls in file
GitHub: jcla1/AdventOfCode
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);
0
0
0
ramda.clone is the most popular function in ramda (30311 examples)