# Some questions about function of function

**URL:** <https://discourse.julialang.org/t/some-questions-about-function-of-function/91144>\
**Category:** General Usage\
**Tags:** question, function\
**Created:** [December 2, 2022, 12:28pm UTC](https://discourse.julialang.org/t/some-questions-about-function-of-function/91144 "2022-12-02T12:28:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xuekui\_wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xuekui_wang/32/30746_2.png) [@Xuekui\_wang](https://discourse.julialang.org/u/Xuekui_wang)\
**Post date:** [December 2, 2022, 12:28pm UTC](https://discourse.julialang.org/t/some-questions-about-function-of-function/91144/1 "2022-12-02T12:28:13Z")

</div>

I am not so familiar to Julia.  
I have a program as follows, it means function t2 is a parameter of t5.  
My question is that why it needs `(args...; kwargs...) -> begin` in beginning of t5 , and why here is `;`, if it is `(args..., kwargs...) -> begin` ,there will be erros.  
Thanks for your help.

```julia
function t5(t2, x,y)
    (args...; kwargs...) -> begin
        return t2(args..., kwargs...)+x+y
    end
end

function t2(theta,gamma)
    return theta*gamma
end

t5(t2, 3, 4)(2,5)

```

---

<div class="post-metadata">

**Author:** ![Dan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan/32/42581_2.png) [@Dan](https://discourse.julialang.org/u/Dan)\
**Post date:** [December 2, 2022, 1:25pm UTC](https://discourse.julialang.org/t/some-questions-about-function-of-function/91144/2 "2022-12-02T13:25:53Z")

</div>

In Julia, functions get both positional arguments and keyword arguments. When defining a function, the positional arguments are defined first and then a semicolon `;` separates them from the keyword arguments declaration.

When calling functions, the same convention is used, except the `;` can be replaced with a `,`. Probably for backward compatibility reasons, and possibly to make calls look nicer. When using the splat (`...`) operator for `kwargs` this is no longer optional, as Julia will interpret the expanded `kwargs` as positional parameters with no `;`.

Therefore, in the example shown,

> [@Xuekui\_wang](#):
>
> `return t2(args..., kwargs...)+x+y`

should be written as

```julia
return t2(args...; kwargs...)+x+y

```

The Julia docs do a good job at describing these notions. The relevant link is:  
[https://docs.julialang.org/en/v1/manual/functions/#Keyword-Arguments](https://docs.julialang.org/en/v1/manual/functions/#Keyword-Arguments)

---

<div class="post-metadata">

**Author:** ![Xuekui\_wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xuekui_wang/32/30746_2.png) [@Xuekui\_wang](https://discourse.julialang.org/u/Xuekui_wang)\
**Post date:** [December 2, 2022, 2:03pm UTC](https://discourse.julialang.org/t/some-questions-about-function-of-function/91144/3 "2022-12-02T14:03:49Z")

</div>

OK, thank you very much, Dan.  
I understand some of this knowledge，and I will continue to study for good use of them.
