Add a filter(_:) method to your Stack structure.
It should take a single argument, a closure that takes an Element and returns a Bool, and return a new Stack<Element> that contains any elements for which the closure returns true.
With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, interactive tutorials, and more.