These are chat archives for ramda/ramda
// uses v from [k, v] from R.toPairs const withValue = R.over(R.lensIndex(1)); return R.compose( R.fromPairs, R.adjust(withValue(v => offBy + v), 0), // adjust the biggest one R.map(withValue(Math.round)), // round the values R.sortBy(withValue(v => Math.round(v) - v)), // largest difference at the top R.toPairs )(percentages);
R.overtakes 3 arguments, and we're partially applying it with 1. The 2nd is coming from out our custom logic, then the 3rd goes through
adjust, then into
const minMax = R.converge(R.pair, [(b) => Math.min(...b), (a) => Math.max(...a)]) minMax([1, 2, 3, 4, 5, 6, 7]) //[1,7]
tranducers, all it's do is capturing reduce operation and initial value.
[["a", "b"], [1, 3]])?
[ Object.keys(obj), Object.values(obj) ]. What's wrong here? Order isn't guaranteed
valuesthey are referring to are ramda functions
R.values. Your solution would work, but it assumes you have the data you are operating on. In a composition, it would have to look more like..
obj => [Object.keys(obj), Object.values(obj)]