# Does map have a traversal order?

**URL:** <https://discourse.julialang.org/t/does-map-have-a-traversal-order/105755>\
**Category:** Internals & Design\
**Tags:** question\
**Created:** [November 3, 2023, 1:31pm UTC](https://discourse.julialang.org/t/does-map-have-a-traversal-order/105755 "2023-11-03T13:31:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [November 3, 2023, 1:31pm UTC](https://discourse.julialang.org/t/does-map-have-a-traversal-order/105755/1 "2023-11-03T13:31:11Z")

</div>

Suppose that in `map(f, a1, ...)` the function `f` has side-effects, and `a1` etc are ordered collections (eg arrays or similar).

Is `map` guaranteed to traverse the arguments in the linear-index ordering, or could that theoretically change in a new version of Julia? (I know that it currently does).

---

<div class="post-metadata">

**Author:** ![adienes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adienes/32/37459_2.png) [@adienes](https://discourse.julialang.org/u/adienes)\
**Post date:** [November 3, 2023, 1:41pm UTC](https://discourse.julialang.org/t/does-map-have-a-traversal-order/105755/2 "2023-11-03T13:41:35Z")

</div>

it is not guaranteed

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [November 3, 2023, 1:42pm UTC](https://discourse.julialang.org/t/does-map-have-a-traversal-order/105755/3 "2023-11-03T13:42:14Z")

</div>

Thanks. Is that made explicit anywhere? Or we simply don’t know that it is guaranteed, so it isn’t?

---

<div class="post-metadata">

**Author:** ![adienes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adienes/32/37459_2.png) [@adienes](https://discourse.julialang.org/u/adienes)\
**Post date:** [November 3, 2023, 1:43pm UTC](https://discourse.julialang.org/t/does-map-have-a-traversal-order/105755/4 "2023-11-03T13:43:19Z")

</div>

My information is based only on seeing this convo come up a few times on slack, and each time it was said this is not guaranteed 🙂

> <https://github.com/JuliaLang/julia/issues/51395>
>
> Unlike \`reduce\` where we explicitly don't give any ordering guarantees, we don't… say anything for \`map\`.
> 
> IMO we shouldn't give guarantees for map and add the equivalent to \`foldl\` as a function that does have the guarantees. The goal being that \`map\` should be able to be parallelized/SIMD
