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: Thu, 9 Jun 2016 23:11:18 +0600

On Thu, Jun 9, 2016 at 9:06 PM, Michael Heerdegen
<address@hidden> wrote:

> I don't understand what that means: how can "reduce" be lazy at all?  It
> needs to generate all stream elements to compute the requested value,
> and that at call time.

If the reduction function has an absorbing element, “reduce” can be
lazy with respect to all elements after the absorbing element has been
reached.

Examples:

* Over integers or finite reals, (reduce * '(3 14 15 0 …)) = 0 no
matter what “…” is.
* Over IEEE 754 floats, 0 is not an absorbing element wrt
multiplication, but NaN is.
* (reduce and '(t t t nil …)) is nil.
* (reduce or '(nil nil nil t …)) is t.



reply via email to

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