Changes between Version 4 and Version 5 of ViewPatternsNew


Ignore:
Timestamp:
Jul 18, 2007 4:27:54 PM (7 years ago)
Author:
danl
Comment:

add unfoldr

Legend:

Unmodified
Added
Removed
Modified
  • ViewPatternsNew

    v4 v5  
    236236   foldr f z [] = z 
    237237   foldr f z (x : foldr f z -> xs) =  x `f` xs 
     238 
     239   unfoldr :: (b -> Maybe (a, b)) -> b -> [a]  
     240   unfoldr f (f -> Just (a, b)) = a : unfoldr f b 
     241   unfoldr f other         = [] 
    238242}}} 
    239243