These are chat archives for ramda/ramda

28th
Jun 2016
Hardy Jones
@joneshf
Jun 28 2016 03:43
sequenceA == traverse id
sequence == mapM id
Jun 28 2016 03:53
Funny, I was just looking at the difference between foldable and traversable yesterday
Tushar Mathur
@tusharmath
Jun 28 2016 11:45
Point Free version for const fun = R.curry((value, x) => x(value)) ???
Aldwin Vlasblom
@Avaq
Jun 28 2016 11:47
That's the Thrush combinator. I think it's in Sanctuary; http://sanctuary.js.org/#T
Tushar Mathur
@tusharmath
Jun 28 2016 11:51
@Avaq thanks, but we are not using Sanctuary
is there any other way?
Aldwin Vlasblom
@Avaq
Jun 28 2016 11:56
I don't think Ramda has it. You could define it somewhere in your own code-base: const T = curry((x, f) => f(x))
Or const thrush = flip(call) maybe.
But I don't trust R.call.
Aldwin Vlasblom
@Avaq
Jun 28 2016 12:05
This message was deleted
Whoops, wrong channel that ^
James Forbes
@JAForbes
Jun 28 2016 13:23
I'd personally really like if Ramda had the various combinators. I keep finding myself using converge with identity and wishing I had the S combinator.
Aldwin Vlasblom
@Avaq
Jun 28 2016 13:25
@JAForbes I've been documenting some common combinators and what they are called in different places (https://gist.github.com/Avaq/1f0636ec5c8d6aed2e45). It shows that in Ramda you can use ap in place of the S combinator (because Apply for Function is S).
James Forbes
@JAForbes
Jun 28 2016 13:27
Wow! Let me just think about that for a month or two :)
Aldwin Vlasblom
@Avaq
Jun 28 2016 13:31
It was brought to my attention recently by @rjmk and @xgrommx. My mind was blown too. Here's the discussion: https://gitter.im/ramda/ramda?at=5760102cc77287463a9754b3
James Forbes
@JAForbes
Jun 28 2016 13:35
Thank you so much, that is hugely helpful
Jun 28 2016 16:03
Hi, I'm trying to use Ramda instead of Immutablejs. The functions I lack are mergeDeep (recursive merge), mergeIn (shallow merge on a specific 'path' within the object and updateIn (changing the specific path within the object by a given fn). Does Ramda support these somehow? I even saw the PR for implementing deepMerge (the author called it set), but I cannot found it in the current library anywhere (current set obviously does something else)
Lewis
@6ewis
Jun 28 2016 17:34
@tomaskulich I do not think it has mergeDeed, mergeIn sounds like assocpath
Jun 28 2016 19:07

@6ewis assocPath is close to immutablejs setIn - it overrides the value at the given path. For example:

> R.assocPath(['a', 'b'], {d: 1}, {a: {b: {c: 1}}})
{ a: { b: { d: 1 } } }

while mergeIn should produce:

{ a: { b: { c:1, d: 1 } } }

as the result.