dhall-nix-lib/Integer/product.dhall

14 lines
391 B
Text

--| Multiply all the numbers in a `List`
let Integer/multiply = ./multiply.dhall
let product
: List Integer → Integer
= λ(xs : List Integer) → List/fold Integer xs Integer Integer/multiply +1
let example0 = assert : product [ +2, +3, +5 ] ≡ +30
let example1 = assert : product ([] : List Integer) ≡ +1
let example2 = assert : product [ -2, +3, +5 ] ≡ -30
in product