Updated version of prune that takes a predicate.

Recursion is cool!