ninetynine-1.3.0: Ninety-Nine Haskell Problems
CopyrightCopyright (C) 2023 Yoo Chung
LicenseGPL-3.0-or-later
Maintainerdev@chungyc.org
Safe HaskellSafe-Inferred
LanguageGHC2021

Solutions.Tutorial

Description

Some solutions to Problems.Tutorial.

Synopsis

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} \).