shagie
searching PlanetScale…
- 1.▲
- 2.▲
- 3.▲
- 4.▲
- 5.▲
- 6.▲
25 ms·
- 331.▲
- 332.▲
- 333.▲
- 334.▲
- 335.▲
- 336.▲
- 337.▲
- 338.▲
- 339.▲
- 340.▲
- 341.▲
- 342.▲
- 343.▲
- 344.▲
That wouldn't fail though. It was called only once with [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. The second time it was called with [2, 4, 6, 8, 10]. Likewise, if some_call returned [2, 4, 6, 8, 10] instead, it should only be called with - 345.▲
The python code would be def some_call():
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
def print_evens(nums):
for n in filter(lambda n: n % 2 == 0, nums):
print(n)
def func():
filtered = - 346.▲
- 347.▲
- 348.▲
In C++, the code would look like: #include <vector>
#include <iostream>
#include <algorithm>
std::vector<int> someCall()
{
return {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
}
void printE - 349.▲
- 350.▲
- 351.▲
- 352.▲
- 353.▲
- 354.▲
- 355.▲
- 356.▲
- 357.▲
- 358.▲
- 359.▲
- 360.▲
More ›