These are chat archives for ramda/ramda

23rd
Feb 2018
functionalStoic
@functionalStoic
Feb 23 2018 19:56
Is there difference between R.reduce(R.merge, {}) and R.mergeAll? Each given a list of objects?
Joey Figaro
@joeyfigaro
Feb 23 2018 20:11
Hey all—can anyone point out what I'm missing to unnest/flatten the array in this object? https://goo.gl/CwBYoQ
I'm picking out keys from an object and would like to use one of the key's value (an id) as the key for the second key's value (an array)
if that makes sense
Just figured it out. Hah.
removing the surrounding [] from the second argument to zipObj
Alternatively, anyone see how I might make the map that's surrounding zipObj point-free?
functionalStoic
@functionalStoic
Feb 23 2018 20:58
@joeyfigaro Does this get it?
const buildNotes = pipe(
  map(props(['Id', 'Notes__r'])),
  map(converge(zipObj, [init, tail]))
);
Joey Figaro
@joeyfigaro
Feb 23 2018 21:00
Sure does @functionalStoic :100:
functionalStoic
@functionalStoic
Feb 23 2018 21:00
Good deal!
Joey Figaro
@joeyfigaro
Feb 23 2018 21:01
Thanks a million! Been trying to wrap my head around converge, this is a great practical/real-world use of it. Clicks now.
functionalStoic
@functionalStoic
Feb 23 2018 21:01
Right there with you. I’ve been able to use it a few times now
I guess one of the main advantages being that each of the branching functions gets the array or arguments passed into it
Brad Compton (he/him)
@Bradcomp
Feb 23 2018 21:04
R.mergeAll
Brad Compton (he/him)
@Bradcomp
Feb 23 2018 21:06
@functionalStoic I think mergeAll is equivalent to reduce(merge, {}). They are both implemented in terms of Object.assign for what it's worth...
Mike Lambert
@lax4mike
Feb 23 2018 21:06
@joeyfigaro also, R.tail returns an array
maybe you want R.nth(1)
functionalStoic
@functionalStoic
Feb 23 2018 21:07
@Bradcomp Ok, I just saw them both and wanted to make sure I wasn’t missing something. Thanks!
Denis Stoyanov
@xgrommx
Feb 23 2018 21:30
@joeyfigaro map(lift(objOf)(prop('Id'), prop('Notes__r')), payload)
Mike Lambert
@lax4mike
Feb 23 2018 22:45
@xgrommx could you also have done this? R.map(R.converge(R.objOf, [R.prop("Id"), R.prop("Notes__r")]), payload)
is there a benefit of R.lift vs R.converge?