# @everywhere and pmap inside of a function?

**URL:** <https://discourse.julialang.org/t/everywhere-and-pmap-inside-of-a-function/5405>\
**Category:** Julia at Scale\
**Tags:** question, parallel\
**Created:** [August 16, 2017, 4:46am UTC](https://discourse.julialang.org/t/everywhere-and-pmap-inside-of-a-function/5405 "2017-08-16T04:46:33Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Post date:** [August 16, 2017, 8:29am UTC](https://discourse.julialang.org/t/everywhere-and-pmap-inside-of-a-function/5405/6 "2017-08-16T08:29:47Z")

</div>

This also runs fine for me, even though “smallfunc” isn’t anonymous:

```julia
julia> function bigfunc(iterator)
         localvar = 2.5

         function smallfunc(elm)
           # hypothetical (expensive) operation with elm
           # (in my code this is solving a linear system)
           localvar * elm
         end

         pmap(smallfunc, iterator)
       end
bigfunc (generic function with 1 method)

julia> bigfunc(1:10)
10-element Array{Float64,1}:
  2.5
  5.0
  7.5
 10.0
 12.5
 15.0
 17.5
 20.0
 22.5
 25.0

```

---

_[View the full topic](https://discourse.julialang.org/t/everywhere-and-pmap-inside-of-a-function/5405)._
