These are chat archives for ramda/ramda

12th
Oct 2015
Scott Sauyet
@CrossEye
Oct 12 2015 01:40
@JAForbes there has been talk of indexBy in the past, at least in #931, perhaps elsewhere. Although we were willing to add it, no one stepped up with a PR, and it was dropped for lack of activity. Please feel free to raise another issue.
James Forbes
@JAForbes
Oct 12 2015 01:57
@CrossEye will do
Niloy Mondal
@niloy
Oct 12 2015 06:12
Would anyone be interested in including splitAt in Ramda. Its included in Haskell prelude.
David Chambers
@davidchambers
Oct 12 2015 06:20
:thumbsup: I would use this function, I think.
Niloy Mondal
@niloy
Oct 12 2015 09:30
@davidchambers Created a pull request ramda/ramda#1437
Vladimir Starkov
@iamstarkov
Oct 12 2015 11:58
hey, everybody
does anybody can give a quick tip how to merge arrays having nested arrays inside?
> r.merge({ list: ['asd']}, { list: [1, 2,3] });
{ list: [ 1, 2, 3 ] }
James Forbes
@JAForbes
Oct 12 2015 12:09
R.evolve might help
Scott Sauyet
@CrossEye
Oct 12 2015 12:12
@iamstarkov: can you describe how you would want it to work? I'm assuming that you'd want a list property with ['asd', 1, 2, 3]. Is that right? But how would you distinguish properties where you wanted t to combine from ones you wanted to override?
Vladimir Starkov
@iamstarkov
Oct 12 2015 13:03
@JAForbes can you describe in more details
@CrossEye yep, I want to merge nested arrays also, not just override them
Hardy Jones
@joneshf
Oct 12 2015 14:17
@iamstarkov what does that mean, "merge nested arrays also"?
Vladimir Starkov
@iamstarkov
Oct 12 2015 14:39

@joneshf I mean something like this

equal(
    somehowMerge({ list: ['asd'] }, { list: [1, 2,3] }),
    { list: [ 'asd', 1, 2, 3 ] }
); // true

neither Object.assign, nor r.merge dont fit in this case

Hardy Jones
@joneshf
Oct 12 2015 14:44
Ah, yeah we talked about something similar a while ago. but i dont think it went anywhere
@iamstarkov
What you want is exactly what @airbuggy wanted, a way to control what happens when two keys are the same.
Hardy Jones
@joneshf
Oct 12 2015 14:50
where R.merge == R.mergeWith(R.flip(R.always))
So for now you'll have to roll something yourself. :\
Hardy Jones
@joneshf
Oct 12 2015 14:56
You probably can do it with reduce, toPairs, and propOr, but i don think i have the time right now, sorry.
Hardy Jones
@joneshf
Oct 12 2015 15:07
Maybe I do...
R.reduce((acc, kv) => R.over(R.lensProp(kv[0]), R.pipe(R.defaultTo([]), R.concat(R.__, kv[1])), acc), x, R.toPairs(y))
that's pretty messy though
Vladimir Starkov
@iamstarkov
Oct 12 2015 15:10
yay, will try it out. if you want to track my issue, you can subscribe to iamstarkov/generator-travis#2
Camilo Orrego
@baldore
Oct 12 2015 19:19
Hi! can somebody explain me why Ramda uses different curry functions based on the number of parameters instead of a unique curry function? is it for performance? clean code?
Scott Christopher
@scott-christopher
Oct 12 2015 19:59
@baldore I believe it's mainly to ensure the returned functions report the correct arity via their length property.
John-David Dalton
@jdalton
Oct 12 2015 20:10
@baldore It was introduced for performance ramda/ramda#106.
Camilo Orrego
@baldore
Oct 12 2015 20:15
thanks!
Scott Christopher
@scott-christopher
Oct 12 2015 20:46
Camilo Orrego
@baldore
Oct 12 2015 21:17
aaaa ok. I thought it was related