foldr f (head xs) xs is not the same as foldr1 f xs

David Sabel sabel at ki.informatik.uni-frankfurt.de
Sun May 8 14:46:17 EDT 2005


Ah! thanks you're right, sorry.

My  problem  arose from the fact that

let x = 'A':undefined in head $ (unwords.words) x

does not terminate, but now it's clear: For interspersing the blanks you 
need to evaluate the tail.

Sorry again.

Cheers,
  David


Tomasz Zielonka schrieb:

>On Sun, May 08, 2005 at 08:14:30PM +0200, David Sabel wrote:
>  
>
>>Hi!
>>
>>Subject: foldr f (head xs) xs  is not the same as foldr1 f xs
>>    
>>
>
>I think you forgot about tail: 
>
>foldr f (head xs) (tail xs)
>
>Best regards
>Tomasz
>_______________________________________________
>Glasgow-haskell-users mailing list
>Glasgow-haskell-users at haskell.org
>http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>  
>



More information about the Glasgow-haskell-users mailing list