dhall-nix-lib/Integer/product.dhall

16 lines
514 B
Text

--| Multiply all the numbers in a `List`
let Integer/multiply =
https://prelude.dhall-lang.org/Integer/multiply.dhall
sha256:dcb1ed7c8475ece8d67db92cd249fc728541778ff82509e28c3760e341880e4d
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