How to implement "or" in a scala filter?

scala

Solution

Don't try to be more concise than you have to:

list.filter(x => x % 3 ==0 || x % 5 ==0)

Underscores doesn't work because n-th _ is expanded to n-th argument like this:

list.filter((x,y) => x % 3 ==0 || y % 5 ==0)

Problem

I am trying to implement an "or" filtering a list in scala. ``` list.filter(_ % 3 ==0 || _ % 5 ==0) ``` but I am getting this error: error: wrong number of parameters; expected = 1 So how can this be grouped as one parameter.

Original source

Related problems