See https://github.com/JuliaLang/julia/issues/11750 and https://github.com/JuliaLang/julia/pull/11774.
On Thursday, August 20, 2015 at 9:08:08 AM UTC-7, Pablo San-Jose wrote: > > > > Hi all, > > this is my first post here. I'm a heavy Mathematica user, and a big fan of > Julia. Many thanks to all the great minds involved in creating this > beautiful thing! I am planning to doing a port of all my Mathematica > packages (on quantum transport) to Julia. > > My very first question: > > Say I want to test whether any item generated by an iterator (that > generates integers, but that may involve heavy calculations) equals zero. I > assumed Base.any() would be the function to use. However, if I do this: > > function test(x) >> @show x >> x==0 >> end >> any(test,-5:5) > > > I see that test is applied to *all* elements of the iterator before > deciding that at least one element is zero. This is clearly not optimal. > Why is this? Is this a bug? > > (The same question applies to Base.all()) > > Thanks! >
