Combine Predicates with Logical Conjunction

Learn to combine predicates with logical conjunction.

We'll cover the following

This example wraps a lambda in a function to create a custom conjunctionA custom conjunction is a grammatical conjunction created by combining two or more existing conjunctions to express a specific relationship between clauses or phrases in a sentence. for use with an algorithm predicate.

How to do it

The copy_if() algorithm requires a predicate that takes one parameter. In this recipe, we will create a predicate lambda from three other lambdas:

  • First, we’ll write the combine() function. This function returns a lambda for use with the copy_if() algorithm:

Get hands-on with 1200+ tech skills courses.