# Getting name of functions that were scoped inside another function?

**URL:** <https://discourse.julialang.org/t/getting-name-of-functions-that-were-scoped-inside-another-function/20993>\
**Category:** New to Julia\
**Created:** [February 19, 2019, 9:38pm UTC](https://discourse.julialang.org/t/getting-name-of-functions-that-were-scoped-inside-another-function/20993 "2019-02-19T21:38:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alec\_Loudenback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alec_loudenback/32/278_2.png) [@Alec\_Loudenback](https://discourse.julialang.org/u/Alec_Loudenback)\
**Post date:** [February 19, 2019, 9:38pm UTC](https://discourse.julialang.org/t/getting-name-of-functions-that-were-scoped-inside-another-function/20993/1 "2019-02-19T21:38:53Z")

</div>

I have a system upon which I need to apply a set of scalars which depend on their inputs. I’d like to, for debugging purposes be able to show a list of these scalars and the name of the function, which I think I should be able to do base on this sample code:

```julia
function scalars() 
    foo(x) = 1.0
    bar(x) = 1.5
    return [foo,bar]
end

map((f) -> (f,f(1)),scalars())

```

Outputs:

```julia
2-element Array{Tuple{Function,Float64},1}:
 (getfield(Main, Symbol("#foo#38"))(), 1.0)
 (getfield(Main, Symbol("#bar#39"))(), 1.5)

```

That is, I can see that the name is “available” now that I’m calling it outside of where I defined it. Ideally, I would like to have something like:

```julia
(foo, 1.0)
(bar, 1.5)

```

Is there some way I can cleanly get the name of the function without showing the `getfield...` part?

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [February 19, 2019, 9:56pm UTC](https://discourse.julialang.org/t/getting-name-of-functions-that-were-scoped-inside-another-function/20993/2 "2019-02-19T21:56:23Z")

</div>

```julia
julia> map((f) -> (nameof(f),f(1)),scalars())
2-element Array{Tuple{Symbol,Float64},1}:
 (:foo, 1.0)
 (:bar, 1.5)

```
