# Is there a way to use the 4-argument \`@nloops\` with \`@generated\` on Julia 1.6?

**URL:** <https://discourse.julialang.org/t/is-there-a-way-to-use-the-4-argument-nloops-with-generated-on-julia-1-6/54830>\
**Category:** General Usage\
**Created:** [February 8, 2021, 8:44am UTC](https://discourse.julialang.org/t/is-there-a-way-to-use-the-4-argument-nloops-with-generated-on-julia-1-6/54830 "2021-02-08T08:44:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BridgeBot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bridgebot/32/21491_2.png) [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Post date:** [February 8, 2021, 8:44am UTC](https://discourse.julialang.org/t/is-there-a-way-to-use-the-4-argument-nloops-with-generated-on-julia-1-6/54830/1 "2021-02-08T08:44:12Z")

</div>

Is there a way to use the 4-argument `@nloops` with `@generated` on Julia 1.6? Since the last argument is an anonymous function, it triggers an error about purity now. StatsBase currently uses that so it fails on nightlies: [https://github.com/JuliaStats/StatsBase.jl/blob/3b0b2da5179af9696928e5ecc72794b098c4cb53/src/hist.jl#L465](https://github.com/JuliaStats/StatsBase.jl/blob/3b0b2da5179af9696928e5ecc72794b098c4cb53/src/hist.jl#L465)

Note that the original poster on Slack cannot see your response here on Discourse. Consider _transcribing the appropriate answer back to Slack_, or pinging the poster here on Discourse so they can _follow this thread_.  
[(Original message :slack:)](https://julialang.slack.com/archives/C6A044SQH/p1612773782271300?thread_ts=1612773782.271300&cid=C6A044SQH) [(More Info)](https://github.com/JuliaCommunity/SlackBridge)

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [February 8, 2021, 5:22pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-use-the-4-argument-nloops-with-generated-on-julia-1-6/54830/2 "2021-02-08T17:22:19Z")

</div>

I turns out the anonymous function was not the problem. It’s just that the function included a generator, which is problematic for `@generated`.
