From 4396fb819d38a52242378f12dc131787a4d57eb8 Mon Sep 17 00:00:00 2001 From: Vaniko Akopashvili <49734341+VanoAkofashvili@users.noreply.github.com> Date: Tue, 24 May 2022 22:55:56 +0400 Subject: [PATCH] Corrected mistake Removed redundant parentheses to indicate that `result` is variable variable not function --- manuscript/ch4.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manuscript/ch4.md b/manuscript/ch4.md index 96f5b2cf..787e6515 100644 --- a/manuscript/ch4.md +++ b/manuscript/ch4.md @@ -330,7 +330,7 @@ var compose = (...fns) => **Note:** This implementation of `compose(..)` uses `[...fns].reverse().reduce(..)` to reduce from right-to-left. We'll [revisit `compose(..)` in Chapter 9](ch9.md/#user-content-composereduceright), instead using `reduceRight(..)` for that purpose. -Notice that the `reduce(..)` looping happens each time the final `composed(..)` function is run, and that each intermediate `result(..)` is passed along to the next iteration as the input to the next call. +Notice that the `reduce(..)` looping happens each time the final `composed(..)` function is run, and that each intermediate `result` is passed along to the next iteration as the input to the next call. The advantage of this implementation is that the code is more concise and also that it uses a well-known FP construct: `reduce(..)`. And the performance of this implementation is also similar to the original `for`-loop version.