# Is there a package to that can make partial functions automatically?

**URL:** <https://discourse.julialang.org/t/is-there-a-package-to-that-can-make-partial-functions-automatically/31292>\
**Category:** General Usage\
**Created:** [November 20, 2019, 2:18am UTC](https://discourse.julialang.org/t/is-there-a-package-to-that-can-make-partial-functions-automatically/31292 "2019-11-20T02:18:08Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![Kirby\_Zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirby_zhang/32/36204_2.png) [@Kirby\_Zhang](https://discourse.julialang.org/u/Kirby_Zhang)\
**Post date:** [October 31, 2022, 9:24am UTC](https://discourse.julialang.org/t/is-there-a-package-to-that-can-make-partial-functions-automatically/31292/23 "2022-10-31T09:24:55Z")

</div>

I feel a little confused by this thread. This simple code works in Julia, isn’t it what the author is asking for?

```julia
julia> f(a, b) = (a,b)
f (generic function with 1 method)

julia> f(2,3)
(2, 3)

julia> g(x) = f(999, x)
g (generic function with 1 method)

julia> g(3)
(999, 3)

```

---

<div class="post-metadata">

**Author:** ![Raf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raf/32/3383_2.png) [@Raf](https://discourse.julialang.org/u/Raf)\
**Post date:** [October 31, 2022, 10:39am UTC](https://discourse.julialang.org/t/is-there-a-package-to-that-can-make-partial-functions-automatically/31292/24 "2022-10-31T10:39:05Z")

</div>

No. Partial application is where that `999` is assigned at runtime, and yours is set at compile time.

The example of @stevengj allows this:

```julia
(a, c) -> f(a, b, c)

```

---

<div class="post-metadata">

**Author:** ![Kirby\_Zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirby_zhang/32/36204_2.png) [@Kirby\_Zhang](https://discourse.julialang.org/u/Kirby_Zhang)\
**Post date:** [November 1, 2022, 11:13am UTC](https://discourse.julialang.org/t/is-there-a-package-to-that-can-make-partial-functions-automatically/31292/25 "2022-11-01T11:13:31Z")

</div>

Is he trying to do something like this?

```julia
julia> using DataFrames

julia> savejdf(df::AbstractDataFrame, path::AbstractString) = println("saving $df to $path")
savejdf (generic function with 1 method)

julia> savejdf(df::AbstractDataFrame) = path -> savejdf(df, path)
savejdf (generic function with 2 methods)

julia> savejdf(path::AbstractString) = df -> savejdf(df, path)
savejdf (generic function with 3 methods)

julia> mysave = savejdf("my directory")
#3 (generic function with 1 method)

julia> (mysave)(DataFrame())
saving 0×0 DataFrame to my directory

```

---

<div class="post-metadata">

**Author:** ![tearf001](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tearf001/32/212864_2.png) [@tearf001](https://discourse.julialang.org/u/tearf001)\
**Post date:** [December 17, 2024, 1:37am UTC](https://discourse.julialang.org/t/is-there-a-package-to-that-can-make-partial-functions-automatically/31292/26 "2024-12-17T01:37:13Z")

</div>

Could u make it possible with `kw` version?

[Previous page](https://discourse.julialang.org/t/is-there-a-package-to-that-can-make-partial-functions-automatically/31292.md?page=1)
