From 3e14cd47ccfb89e470abe6c814c295a3f8d62714 Mon Sep 17 00:00:00 2001 From: Noel Welsh Date: Fri, 25 Oct 2024 09:19:16 +0100 Subject: [PATCH] Fix compilation error and typo --- book/src/pages/cycles/fun.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/book/src/pages/cycles/fun.md b/book/src/pages/cycles/fun.md index bd107f07..79c57d73 100644 --- a/book/src/pages/cycles/fun.md +++ b/book/src/pages/cycles/fun.md @@ -58,14 +58,13 @@ def redCircle(n: Int): Image = Image.circle(100 + 24*n).strokeColor(Color.red) val redCircles: Image = - concentricShapes(10, redCircle _) + concentricShapes(10, redCircle) ``` @:figure{ img = "./red-black-circles.svg", key = "#fig:cycles:red-black-circles", caption = "Black and Red Concentric Circles" } -You might notice two things about this example: we're not using function composition, and we duplication in the definitions. +You might notice two things about this example: we're not using function composition, and we have duplication in the definitions. In both cases we draw circles, but they differ in color. -No problem. This feels like a problem we can solve with function composition. Let's give it a go. @@ -91,7 +90,7 @@ def strokeColor(color: Color): Image => Image = With this we can construct the functions we need. -```scala mdoc:silent +```scala mdoc:silent:nest val blackCircle = circle // Black is the default stroke val redCircle = size.andThen(circle).andThen(strokeColor(Color.red)) ```