# How to print function summary programmatically

**URL:** <https://discourse.julialang.org/t/how-to-print-function-summary-programmatically/27230>\
**Category:** New to Julia\
**Created:** [August 6, 2019, 5:12pm UTC](https://discourse.julialang.org/t/how-to-print-function-summary-programmatically/27230 "2019-08-06T17:12:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![GregVernon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregvernon/32/5611_2.png) [@GregVernon](https://discourse.julialang.org/u/GregVernon)\
**Post date:** [August 6, 2019, 5:12pm UTC](https://discourse.julialang.org/t/how-to-print-function-summary-programmatically/27230/1 "2019-08-06T17:12:52Z")

</div>

I’m curious how to programmatically print the function summary that REPL outputs, i.e.

`myFunction doStatic (generic function with 3 methods)`

For instance, I’d like to be able to do the following:

```julia
function myFunction(a::Int32,b::Int32)
    c = (1 + a) ^ b
    return c
end

function myFunction(a::Int32,b::Float64)
    c = (1 + a) ^ Int32(floor(b))
    return c
end

function myFunction(a::Float64,b::Float64)
    c = (1 + a) ^ b
    return c
end

whatFunction(myFunction)
whatFunction(+)
whatFunction(kron)

```

and have the following print to the REPL / terminal / notebook:

```julia
myFunction (generic function with 3 methods)
+ (generic function with 163 methods)
kron (generic function with 18 methods)

```

I realize I could write my own function to do this (pull from `methods()`), but I wanted to check first that I wasn’t missing a built-in. I’ve looked through `show`, `dump`, `println`… I’ve not found anything that replicates the REPL output.

---

<div class="post-metadata">

**Author:** ![jameson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jameson/32/23_2.png) [@jameson](https://discourse.julialang.org/u/jameson)\
**Post date:** [August 7, 2019, 1:05am UTC](https://discourse.julialang.org/t/how-to-print-function-summary-programmatically/27230/2 "2019-08-07T01:05:30Z")

</div>

I’m not sure I follow entirely. Are you looking to `display(myFunction)`?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 7, 2019, 3:13am UTC](https://discourse.julialang.org/t/how-to-print-function-summary-programmatically/27230/3 "2019-08-07T03:13:00Z")

</div>

Or `show(stdout, “text/plain”, myfunction)`, which gives you more control over which stream the output goes to than `display`

---

<div class="post-metadata">

**Author:** ![GregVernon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregvernon/32/5611_2.png) [@GregVernon](https://discourse.julialang.org/u/GregVernon)\
**Post date:** [August 7, 2019, 12:22pm UTC](https://discourse.julialang.org/t/how-to-print-function-summary-programmatically/27230/4 "2019-08-07T12:22:54Z")

</div>

> I’m not sure I follow entirely. Are you looking to display(myFunction)?

@jameson, well this is interesting. I probably should have gone into more detail, but I didn’t think it necessary.

I’m actually trying to use this functionality in NextJournal.

Here’s a [notebook I’ve put together in NextJournal](https://nextjournal.com/a/LVuhyieRmq54TRJtBhZUb) that demonstrates the issue.

**For the future reader. Your solution works in REPL, but may not in some online electronic notebooks.**

---

<div class="post-metadata">

**Author:** ![GregVernon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregvernon/32/5611_2.png) [@GregVernon](https://discourse.julialang.org/u/GregVernon)\
**Post date:** [August 7, 2019, 12:25pm UTC](https://discourse.julialang.org/t/how-to-print-function-summary-programmatically/27230/5 "2019-08-07T12:25:58Z")

</div>

> Or `show(stdout, “text/plain”, myfunction)`, which gives you more control over which stream the output goes to than `display`

@stevengj, thanks! See my reply above to @jameson. Do you think that’s a bug that I should report to NextJournal?
