# How to lazily filter an iterator while also applying a function to it

**URL:** <https://discourse.julialang.org/t/how-to-lazily-filter-an-iterator-while-also-applying-a-function-to-it/35902>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [March 12, 2020, 9:45pm UTC](https://discourse.julialang.org/t/how-to-lazily-filter-an-iterator-while-also-applying-a-function-to-it/35902 "2020-03-12T21:45:24Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![jeffreyesun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreyesun/32/13379_2.png) [@jeffreyesun](https://discourse.julialang.org/u/jeffreyesun)\
**Post date:** [March 18, 2020, 4:56pm UTC](https://discourse.julialang.org/t/how-to-lazily-filter-an-iterator-while-also-applying-a-function-to-it/35902/21 "2020-03-18T16:56:07Z")

</div>

Nonetheless, it can apparently made a difference: [See this post](https://discourse.julialang.org/t/an-assert-statement-makes-my-code-run-faster/25334). It seems that, at one point at least, the presence of an assert triggers a compiler optimization that wouldn’t be triggered otherwise.

---

_[View the full topic](https://discourse.julialang.org/t/how-to-lazily-filter-an-iterator-while-also-applying-a-function-to-it/35902)._
