suminit :: [Int] -> Int -> Int -> (Int,[Int]) suminit xs len acc | len `seq` acc `seq` False = undefined -- :))) | len == 0 = (acc,xs) | otherwise = case xs of [] -> (acc,[]) x:xs -> suminit xs (len-1) (acc+x)
suminit' :: [Int] -> Int -> Int -> (Int,[Int]) suminit' xs !len !acc | len == 0 = (acc,xs) | otherwise = case xs of [] -> (acc,[]) x:xs -> suminit' xs (len-1) (acc+x)
no subject
Date: 2008-02-12 09:52 pm (UTC)no subject
Date: 2008-02-12 10:19 pm (UTC)no subject
Date: 2008-02-13 10:30 am (UTC)Наверное, это тоже самое, но с сахаром. :)
no subject
Date: 2008-02-13 02:54 pm (UTC)