diff --git a/src/gleam_community/maths/float_list.gleam b/src/gleam_community/maths/float_list.gleam
index cc73be6..16e86c2 100644
--- a/src/gleam_community/maths/float_list.gleam
+++ b/src/gleam_community/maths/float_list.gleam
@@ -54,6 +54,7 @@ import gleam/option
import gleam_community/maths/float as floatx
import gleam_community/maths/int as intx
import gleam/io
+import gleam/iterator
///
///
@@ -645,7 +646,7 @@ pub fn sum(arr: List(Float)) -> Float {
///
pub fn product(arr: List(Float)) -> Float {
case arr {
- [] -> 0.0
+ [] -> 1.0
_ ->
arr
|> list.fold(1.0, fn(acc: Float, a: Float) -> Float { a *. acc })
diff --git a/src/gleam_community/maths/int_list.gleam b/src/gleam_community/maths/int_list.gleam
index 9678e91..573f1e3 100644
--- a/src/gleam_community/maths/int_list.gleam
+++ b/src/gleam_community/maths/int_list.gleam
@@ -192,7 +192,7 @@ pub fn sum(arr: List(Int)) -> Int {
///
pub fn product(arr: List(Int)) -> Int {
case arr {
- [] -> 0
+ [] -> 1
_ ->
arr
|> list.fold(1, fn(acc: Int, a: Int) -> Int { a * acc })
diff --git a/src/gleam_community/maths/list.gleam b/src/gleam_community/maths/list.gleam
index 257fa12..40e7e75 100644
--- a/src/gleam_community/maths/list.gleam
+++ b/src/gleam_community/maths/list.gleam
@@ -81,3 +81,90 @@ pub fn trim(arr: List(a), min: Int, max: Int) -> Result(List(a), String) {
}
}
}
+
+///
+///
+/// Generate all $$k$$-combinations based on a given list.
+///
+///
+/// Example:
+///
+/// import gleeunit/should
+/// import gleam/list
+/// import gleam_community/maths/float_list
+///
+/// pub fn example () {
+/// }
+///
+///
+///
+///
+pub fn combination(arr: List(a), k: Int) -> List(a) {
+ todo
+}
+
+///
+///
+/// Generate all permutations based on a given list.
+///
+///
+/// Example:
+///
+/// import gleeunit/should
+/// import gleam/list
+/// import gleam_community/maths/float_list
+///
+/// pub fn example () {
+/// }
+///
+///
+///
+///
+pub fn permutation(arr: List(a)) -> List(a) {
+ todo
+}
+
+///
+///
+/// Generate a list containing all combinations of one element from each of two given lists.
+///
+///
+/// Example:
+///
+/// import gleeunit/should
+/// import gleam/list
+/// import gleam_community/maths/float_list
+///
+/// pub fn example () {
+/// }
+///
+///
+///
+///
+pub fn cartesian_product(xarr: List(a), yarr: List(a)) -> List(a) {
+ todo
+}
diff --git a/test/gleam/gleam_community_maths_float_list_test.gleam b/test/gleam/gleam_community_maths_float_list_test.gleam
index 6421afd..9b24940 100644
--- a/test/gleam/gleam_community_maths_float_list_test.gleam
+++ b/test/gleam/gleam_community_maths_float_list_test.gleam
@@ -481,7 +481,7 @@ pub fn float_list_product_test() {
// An empty list returns 0
[]
|> float_list.product()
- |> should.equal(0.0)
+ |> should.equal(1.0)
// Valid input returns a result
[1.0, 2.0, 3.0]
diff --git a/test/gleam/gleam_community_maths_int_list_test.gleam b/test/gleam/gleam_community_maths_int_list_test.gleam
index e1aa910..e619e23 100644
--- a/test/gleam/gleam_community_maths_int_list_test.gleam
+++ b/test/gleam/gleam_community_maths_int_list_test.gleam
@@ -105,7 +105,7 @@ pub fn int_list_product_test() {
// An empty list returns 0
[]
|> int_list.product()
- |> should.equal(0)
+ |> should.equal(1)
// Valid input returns a result
[1, 2, 3]
diff --git a/test/gleam/gleam_community_maths_list_test.gleam b/test/gleam/gleam_community_maths_list_test.gleam
new file mode 100644
index 0000000..6ac7e9d
--- /dev/null
+++ b/test/gleam/gleam_community_maths_list_test.gleam
@@ -0,0 +1,22 @@
+import gleam/int
+import gleam/list
+import gleam/pair
+import gleam_community/maths/list as listx
+import gleeunit
+import gleeunit/should
+
+pub fn main() {
+ gleeunit.main()
+}
+
+pub fn list_trim_test() {
+ // An empty lists returns an error
+ []
+ |> listx.trim(0, 0)
+ |> should.be_error()
+
+ // Trim the list to only the middle part of list
+ [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
+ |> listx.trim(1, 4)
+ |> should.equal(Ok([2.0, 3.0, 4.0, 5.0]))
+}