# How to automate a laborous task (via Metaprogramming? Need to access variables of the current working space)

**URL:** <https://discourse.julialang.org/t/how-to-automate-a-laborous-task-via-metaprogramming-need-to-access-variables-of-the-current-working-space/36438>\
**Category:** General Usage\
**Tags:** question, metaprogramming, design\
**Created:** [March 24, 2020, 12:09pm UTC](https://discourse.julialang.org/t/how-to-automate-a-laborous-task-via-metaprogramming-need-to-access-variables-of-the-current-working-space/36438 "2020-03-24T12:09:21Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![NilsKintscher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilskintscher/32/13608_2.png) [@NilsKintscher](https://discourse.julialang.org/u/NilsKintscher)\
**Post date:** [March 26, 2020, 7:24pm UTC](https://discourse.julialang.org/t/how-to-automate-a-laborous-task-via-metaprogramming-need-to-access-variables-of-the-current-working-space/36438/13 "2020-03-26T19:24:43Z")

</div>

Thanks for insisting on the fact that I can use functions:

I finally realized that I have to build the expression like that:

```julia
f = :($x_1*$x_2+z*inv($x_3))

```

With this expression and the use of `MacroTools.postwalk`, I was able to construct the functions I need.

(Up to now I always used `f = :(x_1*x_2+z*inv(x_3))`.)

---

_[View the full topic](https://discourse.julialang.org/t/how-to-automate-a-laborous-task-via-metaprogramming-need-to-access-variables-of-the-current-working-space/36438)._
