Why is scanr strict in its third argument?

2017-11-09 Thread Geraint Jones
There are two things you might think of when you think of scanr; or rather, there are two things I think of: a specification scanr f e = map (foldr f e) . tails and an implementation scanr f e = foldr g [e] where g x yss@(ys:_) = f x ys : yss Of course these two differ, because

Re: Why is scanr strict in its third argument?

2017-11-09 Thread David Feuer
I think this discussion would be more appropriate to the libraries list. On Nov 9, 2017 11:05 AM, "Geraint Jones" wrote: > There are two things you might think of when you think of scanr; > or rather, there are two things I think of: a specification > > scanr f e = map (foldr f e) . tail