小编dpa*_*tru的帖子

我什么时候可以依靠 Haskell 懒惰地阅读列表?

为什么我<<loop>>在这里得到一个无限循环 ( ) 运行时错误?

文件反馈.hs:

plus1 :: [Int]->[Int] -- add 1 to input stream
plus1 [] = []
plus1 (x:xs) = (x+1): plus1 xs

to10 :: [Int] -> [Int] -- stop the input stream when it gets to 10
to10 (x:xs) | x < 10 = x : to10 xs
            | otherwise = []

to10plus :: [Int] -> ([Int], Int) -- like to10 but also return the count
to10plus (x:xs) | x < 10 = (x, 1) `merge` …
Run Code Online (Sandbox Code Playgroud)

haskell lazy-sequences

8
推荐指数
1
解决办法
121
查看次数

标签 统计

haskell ×1

lazy-sequences ×1