These are chat archives for ramda/ramda
unnestthere. I had played with a few combinations, but hadn't hit the right one. I don't like seeing
unnestin my code, and figure there's usually a way to avoid it, but I'm not always successful in my endeavors to that end.
const mirrorPivot = converge(concat, [identity, o(reverse, init)])
concat, but somehow missed the obvious one.
identityin the first position, I think "I can probably rewrite that with
chain"; sure enough:
chain(flip(concat), o(reverse, init))
juxt-based solutions, and I'll try to keep that rule in mind in the future. Thanks!
chainworks when the first two arguments are functions. Unfortunately, although I get what's happening there, I'm still not 100% sure why/how it's happening, even after reading the docs for
chainand the linked fantasyland spec. Are you aware of any other writing that explains how this works in more detail, because it's very useful, and I'd like to really internalize how it's doing what it's doing.
@buzzdecafe, Not being familiar with that slick use of chain, I would have done:
const xs = [1,2,3] converge(append, [head, identity])(xs)
Is there any sense in which
chain is special case of
converge, or vice-versa? Can you speak to the appropirateness — semantically, or otherwise — of using one method over the other?
converge(append, [head, identity])(xs)and
mirrorPivotcan be solved with the same abstraction.
converge(append, [head, identity]).
+/ % #is the J verb for “average”. the middle
+/is sum, and
#is length. so you pass it a list, and those two things on the side get executed first (just like the array of transformers in converge, but with a nicer visual metaphor), and the the results are passed to “divide”. And note you don’t have to tell it to do that: any time you have 3 verbs in a row, it automatically works like that.
apdefined for Monads, but in ramda it is defined for Applys?
map, yes? So
Just(2). can't get the infix syntax unfortunately
apis prefix synonym of