From 7f6f4125527e9da05433d411965a7b198a353f2d Mon Sep 17 00:00:00 2001 From: Miroslav Petrik Date: Tue, 25 Dec 2018 13:19:53 +0100 Subject: [PATCH] fix partial function `sum` example --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 94a50c6..c40fed8 100644 --- a/readme.md +++ b/readme.md @@ -926,7 +926,7 @@ A partial function is a [function](#function) which is not defined for all argum // sum :: [Number] -> Number const sum = arr => arr.reduce((a, b) => a + b) sum([1, 2, 3]) // 6 -sqrt([]) // TypeError: Reduce of empty array with no initial value +sum([]) // TypeError: Reduce of empty array with no initial value // example 2: get the first item in list // first :: [A] -> A @@ -957,7 +957,7 @@ Fortunately a partial function can be converted to a regular (or total) one. We // sum :: [Number] -> Number const sum = arr => arr.reduce((a, b) => a + b, 0) sum([1, 2, 3]) // 6 -sqrt([]) // 0 +sum([]) // 0 // example 2: get the first item in list // change result to Option