- Join over
**1.5M+ people** - Join over
**100K+ communities** - Free
**without limits** - Create
**your own community**

- Jan 31 2019 22:17CrossEye commented #2779
- Jan 31 2019 21:04ArturAralin commented #2779
- Jan 31 2019 20:08CrossEye commented #2779
- Jan 31 2019 18:56buzzdecafe commented #2631
- Jan 31 2019 18:09ArturAralin commented #2779
- Jan 31 2019 16:18CrossEye commented #2779
- Jan 31 2019 16:10CrossEye commented #2631
- Jan 31 2019 16:06CrossEye commented #2777
- Jan 31 2019 14:44ArturAralin opened #2779
- Jan 31 2019 07:39inferusvv commented #2631
- Jan 31 2019 03:07sespinozj commented #2771
- Jan 31 2019 02:33machad0 commented #2771
- Jan 31 2019 02:26JeffreyChan commented #2777
- Jan 30 2019 14:30CrossEye closed #2777
- Jan 30 2019 01:42JeffreyChan commented #2777
- Jan 29 2019 16:28CrossEye commented #2777
- Jan 29 2019 15:50mbostock commented #2772
- Jan 29 2019 15:48CrossEye commented #2772

I was messing around with converge, zipObj and unapply an flip, but things got nasty when I had to unapply everything: zipObj, difference and flip(difference)

Hm, i am somehow stuck right now - I want to write a function that wraps functions which might throw and returns either

`Right(result)`

or `Left(errorObject)`

: https://gist.github.com/gilligan/66a1ac0431a0e77fdaae - this is not quite right. Can anyone help out ?
gilligan: bit like https://github.com/plaid/sanctuary#encaseeither--error---a------b------either-a-b ?

driving me bonkers that i am not getting my stuff right though

x__X

arguments is not available in arrow functions

FYI... I'm working on replacing an utility library I created a few years ago with a Ramda based version: https://github.com/Hypercubed/florida

It's kind of like a hyperactive version of a lens... but only the getter. Any feedback would be appreciated.

@Hypercubed it sounds like you want something like: http://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Function.html#v:on

Given the type

`(b -> b -> c) -> (a -> b) -> a -> a -> c`

it almost writes itself.
`const on = curry((f, g, x, y) => f(g(x), g(y)));`

Since you need a value of type

`c`

, you only have one place to get it, the `f`

function. Well, the `f`

function needs two values of type `b`

, and you can only get those from the `g`

function. The `g`

function needs a value of type `a`

, and you have two of those: `x`

, and `y`

. So you be fair and send both values `x`

, and `y`

to `g`

, then send that to `f`

, and your function wrote itself.
And once you add in the law

`on(f, identity) == f`

you have no other choice for an implementation.
Hi All,

my brain isn't in a good shape today and I got stuck on trying to do the following:

I want something like

my brain isn't in a good shape today and I got stuck on trying to do the following:

I want something like

`R.ap`

, but a variant which is not going to do every permutation, but only apply first function to the first argument in the list, the second function to the second argument in the list, and so on:`R.ap([R.multiply(2), R.add(3)], [1,2]); // => [2, 5]`

any ideas?

maybe avoid the

`curry`

in this case?
`zipWith((f, x) => f(x), [R.multiply(2), R.add(3)], [1,2])`

Use a data type that encodes this behavior is another possibility.

```
const ZipArray = xs => ({
toArray: xs,
map(f) {
return ZipArray(R.map(f, xs));
},
ap({toArray: ys}) {
if (xs.length == 0 || ys.length == 0) {
return ZipArray([]);
} else {
const y = R.head(ys);
const x = R.head(xs);
const yss = R.tail(ys);
const xss = R.tail(xs);
return ZipArray(R.prepend(x(y), ZipArray(xss).ap(ZipArray(yss)).toArray));
}
},
});
R.ap(ZipArray([R.multiply(2), R.add(3)]), ZipArray([1,2])).toArray //=> [2, 5]
```

Or I guess you could clean it up...

```
const ZipArray = xs => ({
toArray: xs,
map(f) {
return ZipArray(R.map(f, xs));
},
ap({toArray: ys}) {
return ZipArray(R.zipWith((f, x) => f(x), xs, ys));
},
});
R.ap(ZipArray([R.multiply(2), R.add(3)]), ZipArray([1,2])).toArray //=> [2, 5]
```

probably better that way, since tco.

https://medium.com/@ayanonagon/the-y-combinator-no-not-that-one-7268d8d9c46 has a good write up on the Y combinator

s/had/has

There should be no issues doing points-free recursion, but I'm not going to try an example on my phone.

the use of

`R.nthArg`

might be cheating a little, depending on your rules of points-free golf :D
Yes, I was once again missing the point. It sounded easy to do recursion points-free until I tried it. Of course is not possible to do naively, but something like the Y-comb would allow it. But as always with the Y-combinator, it feels mostly like a trick. You prove that it can be done, but you don't use it for anything real.

seems pretty free of points