These are chat archives for ramda/ramda

17th
Sep 2016
David Chambers
@davidchambers
Sep 17 2016 13:12 UTC
If you're interested in understanding why functions are applicative functors, check out the answer I just posted on Stack Overflow.
boxofrox
@boxofrox
Sep 17 2016 17:41 UTC
@davidchambers , does ramtuary provide a means to log result in the output pane, or does it only report the result of the last expession?
David Chambers
@davidchambers
Sep 17 2016 17:42 UTC
I think you're after a different David. @davidchase, perhaps?
boxofrox
@boxofrox
Sep 17 2016 17:42 UTC
lol, i am. sorry :)
Andrea Scartabelli
@ascartabelli
Sep 17 2016 17:45 UTC
@davidchambers Let me say that your answer was a really great explanation: not so often people are so concise and clear and always keeping track of the goal at the same time!
David Chambers
@davidchambers
Sep 17 2016 17:47 UTC
Thanks, @ascartabelli. Each time I explain this idea it becomes a little clearer in my own mind, allowing me to give a slightly better explanation the next time.
Andrea Scartabelli
@ascartabelli
Sep 17 2016 17:49 UTC
Indeed, @davidchambers, I always thought I learnt more about programming while trying to help others rather than studying by myself
Markus Pfundstein
@MarkusPfundstein
Sep 17 2016 19:41 UTC
hello!

does anyone know if there is a direct way to curry a class method and/or a regular function declaration? I know workarounds but I don’t like them
e.g.

class Foo { 
    bar(a,b) {   // <——

and

function foo(a, b) {   <——
David Chase
@davidchase
Sep 17 2016 20:05 UTC
Didn't know anyone still outside used ramtuary outside of a few folks good to hear it's still a thing 👌🏻
Brad Compton (he/him)
@Bradcomp
Sep 17 2016 20:05 UTC
@MarkusPfundstein What do you mean by a direct way to curry them?
Markus Pfundstein
@MarkusPfundstein
Sep 17 2016 20:50 UTC

@Bradcomp let’s say I want to curry Foo#bar in the example above. I can’t do:

class Foo {
     R.curry(bar(a,b) =>

nor
bar = R.curry((a,b) => {

The only possibility that I know is to do

class Foo {
      … // no bar here
}
Foo.prototype.bar = R.curry(function (a,b) {

But this makes class declarations kinda ugly. Same with function.

How would you curry

function f(a,b) { return a*b; } without doing s.th.

function f_(a, b) { return a*b; }
const f = R.curry(f_);
I saw one talk from Lonsdorf where he had an autoCurry method. It was a bit like this: function f(a, b) { return a *b; }.autoCurry();
I am wondering if ramda supports something like this as well?
Craig Dallimore
@craigdallimore
Sep 17 2016 20:59 UTC

Does it need to be a class? Can you get away with

obj = {
  method : curry((a, b) => ... )
}

?

Brad Compton (he/him)
@Bradcomp
Sep 17 2016 21:02 UTC
Yeah, or
var bar = curry(function(a, b) { ...} )

class Foo {
   bar
}
Forgive me for not knowing very much about class syntax
Craig Dallimore
@craigdallimore
Sep 17 2016 21:02 UTC

In a similar fashion, can your function be declared as

const f = curry((a, b) => a*b)

`?

const fPrime => a => b => a*b;
Brad Compton (he/him)
@Bradcomp
Sep 17 2016 21:07 UTC
I mean, I suspect you might run into some issues with this somewhere along the line
Markus Pfundstein
@MarkusPfundstein
Sep 17 2016 21:49 UTC
I just wonder. I like the new class syntax but it seems to have some drawbacks :(