From 50862d1acc5c74fbf8de2b46f35c17c9a49057a4 Mon Sep 17 00:00:00 2001 From: inoas Date: Tue, 31 Jan 2023 15:02:24 +0100 Subject: product-of-empty-list-of-numbers-could-return-1 --- src/gleam/float.gleam | 2 +- src/gleam/int.gleam | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gleam/float.gleam b/src/gleam/float.gleam index 5893b44..1ee175c 100644 --- a/src/gleam/float.gleam +++ b/src/gleam/float.gleam @@ -427,7 +427,7 @@ fn do_sum(numbers: List(Float), initial: Float) -> Float { /// pub fn product(numbers: List(Float)) -> Float { case numbers { - [] -> 0.0 + [] -> 1.0 _ -> do_product(numbers, 1.0) } } diff --git a/src/gleam/int.gleam b/src/gleam/int.gleam index eafbade..7623331 100644 --- a/src/gleam/int.gleam +++ b/src/gleam/int.gleam @@ -465,7 +465,7 @@ fn do_sum(numbers: List(Int), initial: Int) -> Int { /// pub fn product(numbers: List(Int)) -> Int { case numbers { - [] -> 0 + [] -> 1 _ -> do_product(numbers, 1) } } -- cgit v1.2.3