# How do I see what's inside a function?

**URL:** https://discourse.julialang.org/t/how-do-i-see-whats-inside-a-function/88599
**Category:** New to Julia
**Created:** [October 11, 2022, 10:26pm UTC](https://discourse.julialang.org/t/how-do-i-see-whats-inside-a-function/88599 "2022-10-11T22:26:48Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)
#### Post date: [October 12, 2022, 8:20am UTC](https://discourse.julialang.org/t/how-do-i-see-whats-inside-a-function/88599/7 "2022-10-12T08:20:26Z")

</div>

> [@chadagreene](#):
>
> I defined `foo` in the REPL, and then I wanted to tinker with it. It seems crazy to me that Julia knows what expression is inside `foo`, but she won’t tell me what it is. Would be cool to be able to access it directly in the REPL

It sounds you want to bring back the function definition at the REPL prompt and be able to edit it. If so, `Ctrl-R` will serve you well for this. `Ctrl-R` followed by `foo(` will search in your REPL history for lines that contain `foo(` and display the latest one it finds. You can press Ctrl-R again to repeat the search to find an occurrence before that. Once you find the method definition you want, just pressing any arrow key will bring you out of the search mode and let you edit the definition. (If you use OhMyREPL.jl, you get a nice menu when you press Ctrl-R, which makes this process even easier and more intuitive.)

If you do want the function definition as an _output_, [CodeTracking.jl](https://github.com/timholy/CodeTracking.jl) has a `@code_string` macro for that.

```julia
julia> using CodeTracking

julia> foo(a,b) = a + b
foo (generic function with 1 method)

julia> @code_string foo(1, 2)
"foo(a,b) = a + b"

```

It’s meant to be a lightweight subset of Revise.jl functionality, so should be fine to load in your startup.jl if you need this often.

---

_[View the full topic](https://discourse.julialang.org/t/how-do-i-see-whats-inside-a-function/88599)._
