These are chat archives for ramda/ramda

3rd
Oct 2017
James Forbes
@JAForbes
Oct 03 2017 01:23

Hey y'all could I get some support on this thread on removing promise integration for a compose operator proposal.

TheNavigateur/proposal-pipeline-operator-for-function-composition#3

Even if its just a :thumbsup:

Going to cross post sorry for the annoyance.

Brad Compton (he/him)
@Bradcomp
Oct 03 2017 04:16
:+1:
Alastair Hole
@afhole
Oct 03 2017 15:55
Hey all I was just looking at ramda/ramda@f494250 and I wondered what "side-effects": false, in the package.json is doing? Is it related to babel-plugin-annotate-pure-calls?
Jonah
@jonahx
Oct 03 2017 18:23
@JAForbes :thumbsup:
Jonah
@jonahx
Oct 03 2017 18:29

From that thread, the last post:

Composition (compose operator) and application (apply aka pipe operator) aren't one in the same.

I’m not sure I see the difference. Can someone clarify?

Oh nm, the compose could return a new function. Pipe applies a value through a composition of functions. … correct?
Robert Mennell
@skatcat31
Oct 03 2017 19:04
@JAForbes is your comment ot the effect of "Let people impliment their own composition, don't bake it in?
Rick Medina
@rickmed
Oct 03 2017 19:05
correct. Compose outputs a function. pipe outputs a value @jonahx
Jonah
@jonahx
Oct 03 2017 19:07
@rickmed Yeah it’s not a salient distinction for me, especially since I’m used to auto-currying now. the result of calling pipe might return a function, might return a value, depending on how many arguments I give it. how bout we just propose that all JS functions be auto-curried :)
Rick Medina
@rickmed
Oct 03 2017 19:11
is a bit confusing within ramda's context bc ramda's pipe function outputs a function ("left to right compose") and the js proposed ("|>", pipe operator) is a forward application operator (akin to nix's pipe and a few other languages)
@jonahx that would be amazing and iirc it was one of the arguments to use "|>" for forward application instead of composition
Robert Mennell
@skatcat31
Oct 03 2017 19:13
Why is this even a discussion in a proposal for inclussion in JS? This should be a userland decleration, not an inbuilt JS operator...
Jonah
@jonahx
Oct 03 2017 19:14
@skatcat31 but how would you define new syntax in userland (unless your compiling with sweet.js or similar)?
Robert Mennell
@skatcat31
Oct 03 2017 19:15
why new syntax at all? It does nothing but confuse people who have to look up what an esoteric symbol means. Why not instead just use a function to compose functions? They're simple enough to impliment
Jonah
@jonahx
Oct 03 2017 19:16
@skatcat31 I actually disagree with that. It’s really nice to have that baked into the syntax. Improves readability a lot.
Robert Mennell
@skatcat31
Oct 03 2017 19:18
@jonahx once you look it up sure, but what's easier to see for a first time user: compose(fn3, fn2, fn1) or fn3 +> fn2 +> fn1 ? I have to google the latter to learn what that operator is. compose if at first glane and every glance a function
ontop of that it's less cahracter in the long run. Say you have HUGE compositions: +> operator is always # of fns * 2 while compose function is 9 + # of fns. I'm guessing I'm just lazy is the reason I don't like the +>?
don't want to look it up
Jonah
@jonahx
Oct 03 2017 19:22
@skatcat31 that’s a tradeoff i’m more than willing to make. if googling for an operator is going to be the threshold of effort that turns you off from JS, i don’t have much sympathy for you. making the language newb friendly should be a concern, but not one the overwhelms all other considerations. and honestly if your level of knowledge is that low, you’ll likely have to look up what that means too (also, does it compose from right-to-left or left-to-write? — better look that up as well)
^^ btw “you” was the general “you” newb, not you robert mennell, in case that wasn’t clear.
Robert Mennell
@skatcat31
Oct 03 2017 19:22
@jonahx figure the you was generic, not aimed at me. Thanks for clarifying though :wink:
compose implys functional composition on a mathematical definition(at least to any methmatically minded person)
so always right to left. It's compose(f,g)(x) == f(g(x))
Jonah
@jonahx
Oct 03 2017 19:24
ha, sure, but how many JS newbs will have that information — let alone so close at hand that they immediately see that? i’m saying the people you’re talking about won’t even know what compose means…
Robert Mennell
@skatcat31
Oct 03 2017 19:25
fair point
but if you can't figure out compose(square, double, third) does by giving it 6...
@jonahx althoguh counter argument, what order does +> do it in?
does it feed the result(traditional use of >) to the next function?
Robert Mennell
@skatcat31
Oct 03 2017 19:42

Take no language level action, because there's plenty of elegant userland solutions - James Forbes

I'm adding that to my wall of quotes. I like this on a deep personal level.

const missyElliot = reverseBits +> v => -1 * v +> v => v--;

Ew. I don't like that at all...

const missyElliot = compose( reverseBits, v => -1 * v, v => v--);
Robert Mennell
@skatcat31
Oct 03 2017 19:48
incase yo udon't get the funciton name: bring it down(decrement), flip it(invert it), and reverse it(reverseBits)