Here's a much better article with a similar title: https://pdfs.semanticscholar.org/c9e7/3fc7ec81458057e6f96de1...
(match
(list (> x y) (stringp foo) (oddp n))
[(list #t _ #t ) (whatever)]
[(list _ #t _ ) (other-thing)]
[(list #t #f _ ) (etc)])
... or is that the joke :) // lambda
float retVal = 0;
std::for_each(mb.cbegin(), mb.cend(), [&](item x) { retVal += item.price; });
return retVal;
// pure iterator
float retVal = 0;
for (auto it = mb.cbegin(); it != mb.cend(); ++it)
{
retVal += it->price;
}
return retVal;
... and the first would be better off as: return std::accumulate(mb.cbegin(), mb.cend(), 0f,
[](float acc, item x) { return acc + x.price; });
I think the need to use ref-capture (since you only get a side-effecting `std::function` to play with in their sample) would be the thing most likely to throw people off – as it’s something that should be avoided in most code, anyway ;)