whoa

Hi guys. Anyone around? I'm looking for some help on how to filter down an object based on multiple "contains"

Sounds like

`where`

? and then use `contains`

inside that?
how can I chain contains for multiple n values (I don't knwo how many of these values I will have to look for)

i basically got it to work for two with a AND(contains,contains) inside a filter but obvious it's not very robust

I tried wrapping the contains in an allPass but that doesn't seem to work.

Can you show an example of what you have?

yes

I just paste the REPL url right?

yea thats fine

deleted...

character limit

the idea is to go into the "runes" property of every item and then see if "runes" includes all of a number of chosen runes (e.g. I did this with just two, but it could go up)

`const matchingRunes = (runes) => filter(compose(any(flip(contains)(runes)), prop('runes')), rws);`

MatchingRunes(['Tir', 'Eth'])

Should really pass the rws into that function too

seems to be giving me an "or" match

also how the heck did you come up with that? :D

impressive

Superb docs :)

heh

any idea on how I can turn it into an "and" match? (or rather "at least" i.e. contains at least these x runes in matchingRunes)

```
compose(
equals(0),
prop('length'),
difference(['Tir', 'Bang']),
prop('runes')
),
rws);
```

```
const matchingRunes = (runes) =>
filter(
compose(
equals(0),
prop('length'),
difference(runes),
prop('runes')
),
rws);
```

Might work

think this one is it :D

sweet :)

where does prop('length') come from?

like array.length?

Yea, its the length property on the array

how do you know it's on the array and not like "rws" which prop('runes') is?

I def have to read mroe about FP basics it looks like :(

difference will return an array of the difference between the input and the runes array. Then if that is equal to 0 they are both included so it matches

so is it this: filter rws where difference of ('runes' vs 'runes_ourarray') has a length of 0

yep

and if you were to use pipe instead of compose you'd just flip the order on everything and it'd work the same way?

Ah yea, I always use compose but its just personal preference

just trying to get the hang of it. just started using R yesterday and it's quite different to the way I'd do it in normal JS or _/lodash

thanks a lot for your help :)

No worries at all :)

`[{a: 1b:1}, {a:2,b:2}]`

and `[1,2]`

i want combine these two array and produce result like `[{a:1,b:1,c:1},{a:2,b:2,c:2}]`

hi, I'm trying to reduce a value from a custom function and I don't want to send the acc + value to that function bud I'd like to use R.add() instead

any suggestions on how to do this?

nvm, fixed it with R.sum()

other noob question, why is the following working:

```
const kpiValue = (definition, year, month, role) =>
compose(
Math.floor,
parseFloat
)(pathOr(0, ['kpiData', definition, year, month, 'value'], role))
```

but

```
const kpiValue = (definition, year, month, role) =>
compose(
Math.floor,
parseFloat,
pathOr(0, ['kpiData', definition, year, month, 'value'], role))
```

Isn't? (Error: First argument to _arity must be a non-negative integer no greater than ten)

The docs say: `The rightmost function may have any arity; the remaining functions must be unary.`

isn't the last function considered the 'rightmost' ?

I don't think anything is calling compose in the second one, so kpiValue is returning a function?

Or, pathOr is returning a value because it's fully applied there

so it's like you have

`compose(Math.floor, parseFloat, 0)`

@akhileshv You can use:

`R.zipWith`

`[Function: f2]`

`a is not defined`

@laduke thanks, so

`compose(Math.floor, parseFloat, 0)`

isn't supposed to work either and give an error?
@ram-bot

```
const a1 = [{a: 1, b: 1}, {a: 2, b: 2}];
const a2 = [1, 2];
zipWith((fst, snd) => merge(fst, {c: snd}), a1, a2);
```

`[ { a: 1, b: 1, c: 1 }, { a: 2, b: 2, c: 2 } ]`

There we go

right, you could do like

`compose(..., pathOr(0, ['kpiData', definition, year, month, 'value'])(role)`

i think
that makes sense, thanks

I'm helping!

tx @Bradcomp