Copyright | Copyright (C) 2023 Yoo Chung |
---|---|
License | GPL-3.0-or-later |
Maintainer | dev@chungyc.org |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Some solutions to Problems.Tutorial.
Synopsis
- sumNumbers :: Integer -> Integer
- sumNumbers' :: Integer -> Integer
- sumNumbers'' :: Integer -> Integer
Documentation
sumNumbers :: Integer -> Integer Source #
Add numbers from 1 to a given number n
.
sumNumbers' :: Integer -> Integer Source #
Add numbers from 1 to a given number n
.
Accumulates the sum with a tail recursive function.
sumNumbers'' :: Integer -> Integer Source #
Add numbers from 1 to a given number n
.
Computes \( \frac{n (n+1)}{2} \).