程序代写代做 length :: [a] -> Int length a = case a of

length :: [a] -> Int length a = case a of
[] -> 0
x:xs -> 1 + length xs
sum :: [Int] -> Int sum a = case a of
[] -> 0
x:xs -> x + Sum xs
Foldr
allPositive :: [Int] -> Bool allPositive a = case a of
[] -> True
x:xs -> x > 0 && allPositive xs

Foldr
foldr :: (a -> b -> b) -> b -> [a] -> b foldr f b a = case a of
[] -> b
x:xs -> foldr f (f x b) xs

³£Óú¯Êý

³£Óú¯Êý

³£Óú¯Êý

³£Óú¯Êý

³£Óú¯Êý

³£Óú¯Êý