collections

Custom Iterators in Vala

    For a certain code golf challenge I needed a way to abstract away the mess of dealing with stdin to make my code cleaner (and I can reuse this wherever, which is a big bonus). However, being accustomed to STDIN.each_line in ruby, I wanted an iterator instead of using a while loop in my SumApplication.run() method, so I spent an hour in the vala source figuring out how to write my own iterator that works with foreach(). Now I give this knowledge to you, so you don't have to spend the time yourself!