下一行应该显示它必须如何工作..
[14,2,344,41,5,666]
后[(14,2),(2,1),(344,3),(5,1),(666,3)]
["Zoo","School","Net"]
后[("Zoo",3),("School",6),("Net",3)]
到目前为止,这就是我的代码
zipWithLength :: [a] -> [(a, Int)]
zipWithLength (x:xs) = zipWith (\acc x -> (x, length x):acc) [] xs
我想弄清楚第二行的问题是什么。