I have a very simple use case
Given a list of letters with A and Bs, I want to get the sublist that contains the first N Bs, for example:
- f(3, [A A A B A B A B A A]) = [A A A B A B A B]
- f(2, [A A A B A B A B A A]) = [A A A B A B]
- f(1, [A A B A B A]) = [A A B]
- f(0, [A A B A B]) = []
By following an imperative approach, this is relatively easy, count until we find N Bs, and then get the sublist until that position.
However, I couldn't find any functional solution with lambdas, since the operation on every node seems to be independent from the others (which I guess make sense for parallelization).