These are chat archives for ramda/ramda
assocuse the value of an applied function for each time it's called? for instance, i have an array of circles and i want to
map(assoc('color', getRandomColor()), circles)
const a = R.curry((v,x,n) => v+" "+x+"="+n); const d = a('var'); const e = d('ciao'); const f = R.compose(e, R.inc); f(3);
R.compose. We can only compose when the functions take composable arguments.
fog(x)only works when the output of
f(x)is the only argument to
g. What you're asking is like a compose where
f(x)is the last argument to
g(...args,f(x)). In that case, why don't we write a function that takes
f(x)as an argument itself?
const a = R.curry((v,x,n) => v+" "+x+"="+n); const _a = R.curry((v,x,f,n) => a(v,x,f(n))); const d = _a('var'); const e = d('ciao'); const f = e(R.inc); f(3);
e(R.inc), we can always write
const a = (v,x,n) => v+" "+x+"="+n; const b = (v,x,f,n) => a(v,x,f(n)); const c = R.curry(b)(R.__, R.__, R.inc); const d = c('var'); const e = d('ciao'); e(3);
fixthe value of the
function bto be
R.inc. Depending on your requirement, you can fix it or partially apply it later
Ordin the signature for
ascend(http://ramdajs.com/docs/#ascend). I'm not really sure on what that means in this context though though. From what I can gather through the rest of the docs it might relate to posets, however I'm not sure. Could someone enlighten me on what it means in the context of a function signature?
Ord, it is just to let the user know that their function should return something that can be compared using the native comparison operators (ie