[Haskell-cafe] V.I.P.s and the associativity of merge'

Will Ness will_n48 at yahoo.com
Sat Jan 1 21:42:49 CET 2011


Will Ness <will_n48 <at> yahoo.com> writes:

> 
> ... they *both* turn out to be 
> *completely* and utterly *wrong* :) in a general case (although probably for 
> different reasons).


Sorry, my bad. Thought in terms of "merge", but the definiton used in VIP code 
was really an "union".

When definition was changed to a real "merge", non-removing of duplicates, 
everything was as expected in that case, for both versions.


>  *Main> take 20 $ hfold [concatMap (replicate 3) [n,n+1..]|n<-[1..]]
>  *Main> take 20 $ tfold [concatMap (replicate 3) [n,n+1..]|n<-[1..]]

>  [1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,4,4]




More information about the Haskell-Cafe mailing list