emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations


From: Yuri Khan
Subject: Re: [PATCH] Gnu Elpa: stream.el: Add some more basic stream operations
Date: Fri, 10 Jun 2016 03:06:27 +0600

On Fri, Jun 10, 2016 at 1:41 AM, Michael Heerdegen
<address@hidden> wrote:

>> If the reduction function has an absorbing element, “reduce” can be
>> lazy with respect to all elements after the absorbing element has been
>> reached.
>
> Do you think we should implement something like this for `seq-reduce'?

There are trade-offs.

A left fold which forces the intermediate result before recurring has
good space complexity, but can only be lazy in the values of the
elements, not their number.

A right fold can be lazy in the number of elements, but in the general
case, when applied to a long list, will build a deep evaluation tree.

https://wiki.haskell.org/Foldr_Foldl_Foldl'



reply via email to

[Prev in Thread] Current Thread [Next in Thread]