Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
pp:lecture12 [2022/04/19 12:49] pdmatei |
pp:lecture12 [2022/04/19 12:50] (current) pdmatei |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== L10. Lazy evaluation ====== | + | ====== L12. Lazy evaluation ====== |
<code haskell> | <code haskell> | ||
Line 76: | Line 76: | ||
-- [x, f x, f f x, f f f x, ....] | -- [x, f x, f f x, f f f x, ....] | ||
- | ex' = zipWith (,) (gen (+1) 0) (gen (*2) 1) | + | exx = zipWith (,) (gen (+1) 0) (gen (*2) 1) |
Line 86: | Line 86: | ||
we need to filter out numbers divisible by 2 from the rest of the stream: | we need to filter out numbers divisible by 2 from the rest of the stream: | ||
- | | + | filter (\k-> k `mod` 2 /= 0) rest |
3,_,5,_,7,_,9,_,11,_,13,_,15,_,17,_,19,_,21,_,23,_,25 | 3,_,5,_,7,_,9,_,11,_,13,_,15,_,17,_,19,_,21,_,23,_,25 |