AaronONeal
AaronONeal

Reputation: 3

Checking the length of multiple lists

length' :: [[Int]] -> [Int]
length' [(x:xs)] = map length'[(x:xs)]

The code I have currently prints out the length over one inputted list. How do I go around finding the length for multiple lists.

E.g. Input:  [[2,3,4], [2]] Output: [3,1] 

Upvotes: 0

Views: 683

Answers (1)

Guvante
Guvante

Reputation: 19231

You can just call length on each inputted list using map.

length' :: [[a]] -> [Int]
length' = map length

Upvotes: 5

Related Questions