## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
• Jan 31 2019 22:17
CrossEye commented #2779
• Jan 31 2019 21:04
ArturAralin commented #2779
• Jan 31 2019 20:08
CrossEye commented #2779
• Jan 31 2019 18:56
buzzdecafe commented #2631
• Jan 31 2019 18:09
ArturAralin commented #2779
• Jan 31 2019 16:18
CrossEye commented #2779
• Jan 31 2019 16:10
CrossEye commented #2631
• Jan 31 2019 16:06
CrossEye commented #2777
• Jan 31 2019 14:44
ArturAralin opened #2779
• Jan 31 2019 07:39
inferusvv commented #2631
• Jan 31 2019 03:07
sespinozj commented #2771
• Jan 31 2019 02:33
• Jan 31 2019 02:26
JeffreyChan commented #2777
• Jan 30 2019 14:30
CrossEye closed #2777
• Jan 30 2019 12:13
• Jan 30 2019 01:42
JeffreyChan commented #2777
• Jan 29 2019 21:06
• Jan 29 2019 16:28
CrossEye commented #2777
• Jan 29 2019 15:50
mbostock commented #2772
• Jan 29 2019 15:48
CrossEye commented #2772
John-David Dalton
@jdalton
I donno why skinny arrow wasn't done (no lexical bind)
like CS. There was prolly a ton of discussion (as per usual)
Alex Schenkman
@alesch
@algesten @Avaq @CrossEye Thank you all for the explanations. I’ll have to study them more.
@CrossEye You said you used compose but you thought of it with pipe. How would it be with pipe? In case it becomes easier to read for me.
Scott Sauyet
@CrossEye
R.pipe(R.toPairs, R.map(R.apply(R.assoc('id')))) -- just reversing the parameter order.
Aldwin Vlasblom
@Avaq

@alesch pipe is just compose but reversed: pipe(a, b, c) === compose(c, b, a)

I think compose is meant to resemble nested-function calling, like so: compose(a, b, c)(x) looks like a(b(c(x)))

And pipe is meant to resemble piping, like so: pipe(a, b, c)(x) looks like x > a | b | c

Or that's how I think of them anyway. ;)
John-David Dalton
@jdalton
trying to come up with a better name for useWith and converge. It looks like useWith may be created by way of converge.
naming these things is hhaaaarrrdd grumble grumble
John-David Dalton
@jdalton
modArgs and distArgs woo
John-David Dalton
@jdalton
still not great
but betterish
Raine Virta
@raine
mapArgs
John-David Dalton
@jdalton
that makes me think of 1 function to map over args
Raine Virta
@raine
yeah that's true
John-David Dalton
@jdalton
it could be maybe
converge -> modArgs and useWith -> modPerArg
John-David Dalton
@jdalton
oh snao
so I created a createModArgs
that takes a resolver
the resolver accepts arg, index, arguments (like value, index, array)
it's used to then create a function that passes the transforms args based on the resolves of the resolver
so for useWith the resolver would be identity and for converge it would be function(value, index, args) { return args }
could be baseModArgs(func, transforms, resolver)
Jethro Larson
@jethrolarson
About half the time I use useWith I actually want the W combinator
W (foo)(x) == foo (x)(x)
Jethro Larson
@jethrolarson
Well, that's only true if everything is manually curried, including compose
Matthew Steedman
@knubie
@jdalton I actually think converge makes a lot of sense as a name
Dominik Dumaine
@Bondifrench
Hi all, is there a function in Ramda that loops over the values of an array, and transforms them to keys of an object ie ['FY', 'Q3', 'Q2'] => {'FY': [ some filtered stuff here], 'Q3': [ 'some other stuff' ], 'Q2': [ ]} Use case is when getting some stuff from SQL and transforming into more json like structure
John-David Dalton
@jdalton
@knubie you can be wrong it's ok ; )
Jethro Larson
@jethrolarson
Converge made sense to me. UseWith not so much
Stefano Vozza
@svozza
@Bondifrench do you mean something like fromPairs?
Dominik Dumaine
@Bondifrench
@svozza will have a look, thx
Aldwin Vlasblom
@Avaq
@jdalton I also like converge as a name. I do think useWith would have to be renamed as it can mean anything. How about converge ("To come together from different directions") and disperse ("To strew or distribute widely")? The two words are related because they're kind of opposite, but they also both say something about what happens to the arguments. Besides, I think the subtle differences between the two are too great to name them after the same thing. I'm specifically talking about how the arity for the returned functions is chosen. For converge it will be the biggest arity of all given transformers, and for useWith it will be equal to the amount of given transformers.
Tamas
@bling5630
Hi folks, I would like to use Ramda, but didn't find the right solution, do you have any ideas how can I do this? Thanks
// input

var input = {
apple: 3,
cucumber: 1
};

// desired output

[{
name: 'apple',
quantity: 3
}, {
name: 'cucumber',
quantity: 1
}];

function transformData(content) {

return reduce(function(output, key) {
output.push({
name: key,
quantity: content[key]
});
return output;
}, [], Object.keys(content));

}
Aldwin Vlasblom
@Avaq
@bling5630 var transformData = R.pipe(R.toPairs, R.map(R.zipObj(["name", "quantity"]))) - http://bit.ly/1QfI7WH
Tamas
@bling5630
@Avaq thanks, I really appreciate your help!
Aldwin Vlasblom
@Avaq
You're very welcome. :)
@jdalton The more I think about my naming of disperse, the more I like it! Converge "converges" the arguments with every given transformer, and disperse "disperses" the arguments across all given transformers! :D .. Maybe I'm falling in love, and I should kill my darlings and such.. It's a good name right? :worried:
Danielle McLean
@00dani
@Avaq Well, both converge and useWith necessarily disperse first, converge dispersing the entirety of arguments to all transformers and useWith dispersing individual arguments to individual transformers. So it's a little unclear from that perspective, I think. It's still better than useWith to describe the behaviour at least.
Aldwin Vlasblom
@Avaq
@00Davo Ah, I think of the word "disperse" as kind of "being driven apart". Like a herd of sheep is "dispersed" when a dog runs into the center of the herd. From that point of view I can't think of "dispersing the entirety of arguments to all transformers", because it would involve cloning the sheep ;). But maybe my concept of the word is wrong, I'm no native speaker.
Danielle McLean
@00dani
Ah, true, you're right. "disperse" is literally a synonym for "distribute" in this context, but it does seem to connote "driven apart" where "distribute" wouldn't necessarily.
Perhaps working the word "spread" into useWith's new name would be helpful, considering "spread" is used with similar meaning by Q (and other promise libraries?).
Aldwin Vlasblom
@Avaq
That's an interesting idea too. It lacks the intrinsic connection to the word "converge" (via opposites) that "disperse" does though :). Also, to me just R.spread sounds like an alias to R.apply (which is really what it means in Q and such too), so you would have to come up with a function name containing "spread", which might get long.
Danielle McLean
@00dani
Yeah, convergeSpread was the most logical name based on that, and it really is very long. :smile:
Aldwin Vlasblom
@Avaq
Yeah, plus convergeSpread makes it seem like it sub-categorizes converge behavior-wise, which it doesn't because the arity of the resulting function is decided in a completely different manner.
Danielle McLean
@00dani
Good point.
Scott Sauyet
@CrossEye
I have never minded the name converge. It seemed an improvement on the original fork. But useWith has always been a placeholder in my mind, filling the space until we could arrive at a good name.
diverge is not bad, as long as we don't make to much of its connection with converge. The two words describe well different parts of the operation, and in actuality the way the word 'converge' fits would equally fit useWith.
Raine Virta
@raine
any ideas how to unit test a function pipeline that has IO in the middle? specifically, a function that returns a promise