implements iterable for stack