Could anyone point me to the correct way to write this. I'm struggling as both parts of the compose need state at some point;

export const getFinanceProvidersWithSelected = (state) => {

const mapSelectedOnSelectedTypeId = R.compose(mapSelected(R.prop('typeId')), getSelectedFinanceProviderTypeId)(state);

return R.compose(R.map(mapSelectedOnSelectedTypeId), getFinanceProviders)(state);

};

const mapSelectedOnSelectedTypeId = R.compose(mapSelected(R.prop('typeId')), getSelectedFinanceProviderTypeId)(state);

return R.compose(R.map(mapSelectedOnSelectedTypeId), getFinanceProviders)(state);

};

I can provide more context about some of those methods if required

what i'm really looking for is to have a single expression and remove the declaration of mapSelectedOnSelectedTypeId

```
export const getFinanceProvidersWithSelected = (state) => {
const mapSelectedOnSelectedTypeId = R.pipe(
getSelectedFinanceProviderTypeId
, mapSelected(R.prop('typeId'))
)
return R.pipe(
getFinanceProviders
, R.map(mapSelectedOnSelectedTypeId(state))
)(state)
};
```

(just reformatting to read with highlighting and without scrolling)
```
const mapSelectedOnSelectedTypeId = R.pipe(
getSelectedFinanceProviderTypeId
, mapSelected(R.prop('typeId'))
)
export const getFinanceProvidersWithSelected = (state) =>
R.pipe(
getFinanceProviders
, R.map(mapSelectedOnSelectedTypeId(state))
)(state)
```

I'd probably go for something like that

Ok so just moving the mapSelectedOnSelectedTypeId definition out of the function

it is possible to get rid of the

`=>`

functions with `R.converge`

and `R.useWith`

, but personally I find those trickier to read the flow of
will read the docs on those two, not used them before

Sanctuary also provides a bunch of combinator functions https://sanctuary.js.org/

@kwijibo ? K,S,I,C? Also W will be very useful because W is join for function as monad

@kwijibo But we can implement it only with one basis X

@xgrommx nice

@kwijibo More here https://jsbin.com/sogaxa/1/edit?html,js,output

@FeliciousX I used R.flip:

`const power = R.flip(Math.pow);`

:D

so a working example would be:

```
const power = R.flip(Math.pow);
const squared = power(2);
let numbers = [1, 2, 3, 4, 5, 6];
console.log(R.map(squared, numbers));
```

how might I drop from a

`listA`

where the `id`

field of each object in the list matches an `id`

field of any object in `listB`

?
hi guys! quick question: I need a

`zipWith3`

function (to use it with `a -> a -> a -> a`

). Is there a way to simulate it?
@bgvianyc I only know Ramda superficially, but what you want to do is

`filter`

. Something like this maybe.
@bgvianyc (there's probably a shorter way, though)

@LeonineKing1199 yes, I also wrote it on my own. But I was just wandering that maybe there is simple way to emulate it and that is why it is not included

Oh, well then you don't need any help at all

yeah, actually, my implementation is fairly simple.

```
const zipWith3 = R.curry((fn, arr1, arr2, arr3) => {
return arr1.map((x, i) => fn(x, arr2[i], arr3[i]));
})
```

@raqystyle

```
const zipWith3 = R.curry((fn, arr1, arr2, arr3) => {
return arr1.slice(0, Math.min(...[arr1, arr2,arr3].map(l => l.length)).map((x, i) => fn(x, arr2[i], arr3[i]));
})
```

@bgvianyc ok, had a look at the docs: this is quite better

@ascartabelli nice

@xgrommx I see your point (I hope :smile: ). but I don't understand why do you need to slice the 1st array

@raqystyle

`const zipArray = fn => sources => Array.from(Array(Math.min(...sources.map(s => s.length))), (_, i) => fn(...sources.map(s => s[i])));`

@ascartabelli except I'm trying to make a curried function, how can I modify so it reverses the order of the last two arguments?

@bgvianyc Ramda's functions are already auto-curried, so I suppose you can

`flip(differenceWith(eqProps("id")))`

also I think you can use placeholders:

`differenceWith(eqProps("id"), __, b)`

flip does not seem to work, I accomplished this with

`symmetricDifferenceWith`

, placeholders are great, just tested and it works: http://ramdajs.com/repl/#?code=let%20a%20%3D%20%5B%0A%20%20%7Bid%3A%201%7D%2C%0A%20%20%7Bid%3A%202%7D%2C%0A%20%20%7Bid%3A%203%7D%0A%5D%3B%0A%0Alet%20b%20%3D%20%5B%0A%20%20%7Bid%3A%201%2C%20sane%3A%205%7D%2C%0A%20%20%7Bid%3A%203%7D%0A%5D%3B%0A%0Avar%20check%20%3D%20differenceWith%28eqProps%28%22id%22%29%2C%20__%2C%20b%29%3B%0Acheck%28a%29
sorry for the bad paste

I don't know if I can forgive you

`flip`

should work actually, let me check
@bgvianyc seems to work just fine: have I missed something?

I see, I was building up wrong

also

`symmetricDifferenceWith`

performs a very different operation: "Finds the set (i.e. no duplicates) of all elements contained in the first or second list, but not both."
I agree with different, not very :smile:

eheheh, fair enough

@xgrommx thanks! I didn't know that

`array.from`

takes also mapping function. crazy cool stuff! thanks!