Copyright | Copyright (C) 2021 Yoo Chung |
---|---|
License | GPL-3.0-or-later |
Maintainer | dev@chungyc.org |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Some solutions to Problems.P04 of Ninety-Nine Haskell Problems.
Synopsis
- myLength :: [a] -> Int
- myLength' :: [a] -> Int
- myLength'' :: [a] -> Int
- myLength''' :: [a] -> Int
Documentation
myLength :: [a] -> Int Source #
Find the number of elements of a list.
Add 1 for each element by induction.
myLength'' :: [a] -> Int Source #
Find the number of elements of a list.
Map elements to 1 and return their sum.
myLength''' :: [a] -> Int Source #
Find the number of elements of a list.
Add 1 for each element by induction, but tail recursively.