~ symbol

Ketil Malde [email protected]
29 Aug 2001 13:37:04 +0200


Thanks for the elaborate explanation!  Here's an example that may
serve to elucidate:

The problem, of course, is when unzipping an infinite lists, e.g. the
result of  

        zip [1..] [1..]

which of course looks like

        [(1,1), (2,2), ...]

defining unzip' as

        unzip' = foldr (\(a,b) (as,bs) -> (a:as, b:bs)) ([], [])

(i.e. without the lazy match on (as,bs)), 

        take 4 $ fst $ unzip' $ zip [1..] [1..]

hangs forever, while using the regular, lazy unzip results in the
expected 

        [1,2,3,4]

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants