Add repeatN to Util
This commit is contained in:
parent
fe4a20ade6
commit
12305cc232
13
src/Util.md
13
src/Util.md
|
@ -13,6 +13,19 @@ import Data.List.Lazy
|
||||||
%default total
|
%default total
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
### repeatN
|
||||||
|
|
||||||
|
Recursively applies `f` to `seed` N times
|
||||||
|
|
||||||
|
```idris
|
||||||
|
export
|
||||||
|
repeatN : (times : Nat) -> (f : a -> a) -> (seed : a) -> a
|
||||||
|
repeatN 0 f seed = seed
|
||||||
|
repeatN (S times') f seed = repeatN times' f (f seed)
|
||||||
|
```
|
||||||
|
|
||||||
## Either
|
## Either
|
||||||
|
|
||||||
<!-- idris
|
<!-- idris
|
||||||
|
|
Loading…
Reference in a new issue