Namara

Code daily. Without assist.

2026-08-21

MyLength.hs

myLength :: [a] -> Int
myLength = undefined  -- write this

Implement myLength without using the built-in length.

Reference
myLength :: [a] -> Int
myLength []     = 0
myLength (_:xs) = 1 + myLength xs

One equation per case: the empty list has length zero, and a non-empty list is one plus the length of its tail.