foldr Starts at the Head
Wednesday, January 21st, 2009It took me long enough to realize that foldr still moves from the beginning to the end of a list. Somehow I thought it started at the right (i.e. the tail) of the list. Once I realized that Exercise 7 was easy:
Write your own definition of the standard
takeWhilefunction, first using explicit recursion, and then foldr.