# Is there an idiom for "do this N times"?

**URL:** <https://discourse.julialang.org/t/is-there-an-idiom-for-do-this-n-times/21061>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 21, 2019, 10:13pm UTC](https://discourse.julialang.org/t/is-there-an-idiom-for-do-this-n-times/21061 "2019-02-21T22:13:22Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [February 23, 2019, 1:38am UTC](https://discourse.julialang.org/t/is-there-an-idiom-for-do-this-n-times/21061/21 "2019-02-23T01:38:28Z")

</div>

> [@mbauman](#):
>
> we do say that if the `rand.()` call is dotted then it appears in the “kernel” and will be executed every loop.

Is it an API-level contract? In other words, is there no plan for hoisting out `f.(vector)` in `g.(f.(vector), matrix)` in the broadcasting infrastructure, other than improving LICM in the compiler? I don’t know if changing broadcasting infrastructure is easier than improving the compiler. I’m just curious.

Also, in case this part of the API hasn’t consolidated yet, I wonder if it makes sense to keep the exact number of evaluation unspecified. For example, this lets you hoist out `f.(vector)` even if it cannot be done safely by the compiler (e.g., it uses memoization).

[Previous page](https://discourse.julialang.org/t/is-there-an-idiom-for-do-this-n-times/21061.md?page=1)
