From 5882b16fc72219d309d79afe256807b0bf730535 Mon Sep 17 00:00:00 2001 From: Noel Welsh Date: Wed, 4 Oct 2023 21:16:08 +0100 Subject: [PATCH] Headings for exercises --- src/pages/adt/structural-corecursion.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/adt/structural-corecursion.md b/src/pages/adt/structural-corecursion.md index bcea5762..b7b47d62 100644 --- a/src/pages/adt/structural-corecursion.md +++ b/src/pages/adt/structural-corecursion.md @@ -336,7 +336,7 @@ counter = 0 MyList.fill(5)(getAndInc()) ``` -#### Exercise {-} +#### Exercise: Iterate {-} Implement `iterate` using the same reasoning as we did for `fill`. This is slightly more complex than `fill` as we need to keep to bits of information: the value of the counter and the current value of type `A`. @@ -368,6 +368,9 @@ MyList.iterate(0, 5)(x => x - 1) ``` + +#### Exercise: Map {-} + Once you've completed `iterate`, try to implement `map` in terms of `unfold`.