# Recursively applied 1D function

**URL:** <https://discourse.julialang.org/t/recursively-applied-1d-function/67602>\
**Category:** General Usage\
**Tags:** function\
**Created:** [September 2, 2021, 9:53pm UTC](https://discourse.julialang.org/t/recursively-applied-1d-function/67602 "2021-09-02T21:53:54Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [September 2, 2021, 11:17pm UTC](https://discourse.julialang.org/t/recursively-applied-1d-function/67602/4 "2021-09-02T23:17:15Z")

</div>

[This great post](https://discourse.julialang.org/t/seven-lines-of-julia-examples-sought/50416/81) by @FedericoStra, might be of interest.  
Applying it to OP’s case:

```julia
g(x) = x^2
Gn(x, n) = foldl((y,_) -> g(y), 1:n; init=x)
Gn(1.001, 10)
2.7828855056543795

```

---

_[View the full topic](https://discourse.julialang.org/t/recursively-applied-1d-function/67602)._
