# Can you avoid stating the arguments in an anonymous function?

**URL:** <https://discourse.julialang.org/t/can-you-avoid-stating-the-arguments-in-an-anonymous-function/69795>\
**Category:** General Usage\
**Tags:** macros, dataframes\
**Created:** [October 15, 2021, 1:57am UTC](https://discourse.julialang.org/t/can-you-avoid-stating-the-arguments-in-an-anonymous-function/69795 "2021-10-15T01:57:47Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Lincoln\_Hannah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lincoln_hannah/32/19198_2.png) [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Post date:** [October 15, 2021, 2:45am UTC](https://discourse.julialang.org/t/can-you-avoid-stating-the-arguments-in-an-anonymous-function/69795/6 "2021-10-15T02:45:37Z")

</div>

Background –  
For DataFrames, I’d like an easy way to do row-level operations, and use the column names as variable names and have any created variables added automatically as new columns.

in this discussing a nice method was suggested

> [@Apply function By Row without re-stating column names](https://discourse.julialang.org/t/apply-function-by-row-without-re-stating-column-names/65765/18):
>
> The most complete docs are probably [here](https://dataframes.juliadata.org/stable/man/split_apply_combine/). But in general you want AsTable(slight_smile in the src and AsTable in the dest for a src =\> fun =\> dest command.

but it requires writing a function where you have to specify the column names as inputs and outputs.

```julia
function f(; a, b, ... )
    c = a + b
    d = a - b
    (; a, b, c, d) 
end

D = DataFrame( a=[1,2], b=[3.4) )

@chain D begin
       transform( AsTable(:) => ByRow(x->f(x...)) => AsTable )
end

```

I’d like to avoid re-specifying the column names at all. Something like:

```julia
@chain D begin
        ***drop to row level**** begin
            c = a + b
            d = a - b
            end
end

```

---

_[View the full topic](https://discourse.julialang.org/t/can-you-avoid-stating-the-arguments-in-an-anonymous-function/69795)._
