On Friday, May 1, 2015 at 3:07:03 PM UTC-4, Kristoffer Carlsson wrote: > > Let's say I want to implement an iterator over a vector of objects and > only return (or yield) the objects that have some sort property. >
What you're describing is the filter iterator, which is already implemented in the Julia standard library. If you want to know how to do it, see: https://github.com/JuliaLang/julia/blob/37041bb039b33dfe2ae02a6f17f8f9639df94c5d/base/iterator.jl#L58-L96 For example, Filter(iseven, A) returns an iterator over only the even-valued elements of some array A of integers.
