Skip to content

Commit 7f6f412

Browse files
fix partial function sum example
1 parent ca37a0e commit 7f6f412

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ A partial function is a [function](#function) which is not defined for all argum
926926
// sum :: [Number] -> Number
927927
const sum = arr => arr.reduce((a, b) => a + b)
928928
sum([1, 2, 3]) // 6
929-
sqrt([]) // TypeError: Reduce of empty array with no initial value
929+
sum([]) // TypeError: Reduce of empty array with no initial value
930930

931931
// example 2: get the first item in list
932932
// first :: [A] -> A
@@ -957,7 +957,7 @@ Fortunately a partial function can be converted to a regular (or total) one. We
957957
// sum :: [Number] -> Number
958958
const sum = arr => arr.reduce((a, b) => a + b, 0)
959959
sum([1, 2, 3]) // 6
960-
sqrt([]) // 0
960+
sum([]) // 0
961961

962962
// example 2: get the first item in list
963963
// change result to Option

0 commit comments

Comments
 (0)