3 ms·
> Because of Python's better orthogonality, you can factor out the lazy boolean sequence generator into a function of its own if that's a useful thing to do: Y
by secondcoming 5y ago
> Because of Python's better orthogonality, you can factor out the lazy boolean sequence generator into a function of its own if that's a useful thing to do:
You can do the same in C++:
static bool isEven(int x) { return x % 2 == 0; }
bool foo(const std::vector<int>& v)
{
return v.end()
!= std::find_if(v.begin(), v.end(), isEven);
}
- kragen 5y agoNot the same; no sequence.