Actually, I think that rather than being a misinterpretation of the predicate direction, this may be due to https://github.com/JuliaLang/julia/issues/6125 because the Filter code is older than the new way that Tasks are iterated.
On Thu, Mar 20, 2014 at 11:45 AM, Stefan Karpinski <[email protected]>wrote: > You're absolutely right – I'm testing a patch for this right now. > Fundamentally, this raises an issue that I've brought up before: filter is > poorly named because the name doesn't indicate whether you keep or drop the > items which the predicate matches. It would be much clearer if we had two > functions called select and reject which did filtering where you keep and > drop the things that match, respectively. > > > On Thu, Mar 20, 2014 at 3:23 AM, Miki Tebeka <[email protected]>wrote: > >> Greetings, >> >> I see a different behavior for filter on tasks and ranges. >> >> If I do >> >> for n = filter(iseven, 1:10) >> println(n) >> end >> >> >> I get 2,4,6,8 >> >> However if I do >> >> function ints() >> for i = 1:10 >> produce(i) >> end >> end >> >> for n = filter(iseven, @task ints()) >> println(n) >> end >> >> >> I get 3,5,7,9 >> >> Why is that? >> >> (I noticed that if I change the code to collect(@task ints()) the code >> works as expected). >> >> Thanks, >> -- >> Miki >> > >
