Iterator inspired by Underscore.js and C# Enumerator