I learned functions in terms of sets. Domain and codomain are sets. Function is a set of ordered pairs between them.
How could we go the other way? A set can be "defined" by the predicate that tests membership, but then how do we model the predicates? Some formalism like the lambda calculus?