These are chat archives for ramda/ramda

28th
Mar 2018
Will Farley
@goldhand
Mar 28 2018 01:01

Hopefully this makes sense lol:

I want to use input to create an object. Each property of that object is a function of the input. Is there a term for this kind of transformation or an idomatic way to do this?

example:

const input = [1, 2, 3];

idomaticEvolveFn({
  sum: R.sum,
  avg: R.mean,
  median: R.median,
}, input);  // {sum: 6, avg: 2, median: 2}
Thanks in advance!
Mike Lambert
@lax4mike
Mar 28 2018 01:04
hmm, there is R.converge
Will Farley
@goldhand
Mar 28 2018 01:06
Thanks @lax4mike , converge is often my go to. I’m assuming there’s no built-in for what I’m describing then
Mike Lambert
@lax4mike
Mar 28 2018 01:06
not that i know of
looks like it could be handy though
oh! R.applySpec
ram-bot
@ram-bot
Mar 28 2018 01:08
[Function: f1]
Mike Lambert
@lax4mike
Mar 28 2018 01:08
d'oh
Will Farley
@goldhand
Mar 28 2018 01:09
YES! You rock @lax4mike !!! NICE, this is my dream transform
Mike Lambert
@lax4mike
Mar 28 2018 01:09
@ram-bot
const input = [1, 2, 3];

R.applySpec({
  sum: R.sum,
  avg: R.mean,
  median: R.median,
})(input);
ram-bot
@ram-bot
Mar 28 2018 01:09
{ sum: 6, avg: 2, median: 2 }
Mike Lambert
@lax4mike
Mar 28 2018 01:09
:thumbsup:
Will Farley
@goldhand
Mar 28 2018 01:09
Thanks a lot!
YannisMarios
@YannisMarios
Mar 28 2018 08:17
I am trying to figure out why in react project dissocPath is converting array of objects into object of objects. Has anyone else the same problem?
YannisMarios
@YannisMarios
Mar 28 2018 08:34
I found the problem it was because I was using dissocPath(['contacts', '0'], array); instead of dissocPath(['contacts', 0], array); '0' instead of 0
Max
@maxfi
Mar 28 2018 11:26
Hi all. I'm just getting started with FP and Ramda and was hoping someone might be able to look over https://goo.gl/k7XRLe and point me in the right direction for improvements, further reading, etc. Thanks in advance!
Mirza Brunjadze
@thisdotvoid
Mar 28 2018 21:26
Hello, is there any helper function to create something like "lazy" function application? so you give it a function and arguments, and it returns a function which, when executed (not immediately) will do the application? I'm basically trying to avoid external library for lazy promises.
Mike Lambert
@lax4mike
Mar 28 2018 21:30
maybe something like this:
const lazy = (fn, args) => () => fn(...args);
Mirza Brunjadze
@thisdotvoid
Mar 28 2018 21:34
yeah, I'm using similar function right now, just curious if ramda already had something I could replace with
Mike Lambert
@lax4mike
Mar 28 2018 21:34
hmm, not sure
Mirza Brunjadze
@thisdotvoid
Mar 28 2018 21:35
thanks ❤️