Please, sorry for my English :(
Let's explain my question by examples. We have an array a:
var a = Array(1,1,1,1,2)
We can:
filter
a:a.filter( _ < 2 )Count some elements in a:
a.count (_ < 2)Getting unique elements in the collection:
a.filter { i => a.count(_ == i) == 1 }
The question is: how to do third clause but without introducing variable i? Is it possible to write something like:
a.filter ( a.count ( _ == __) == 1 )
I understand that I can write this (and it's still short):
a.filter { i => a.count(_ == i) == 1 }
But I'm just interested in the answer.