emacs-devel
[Top][All Lists]
Advanced

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

Re: [ANN] New library stream.el in ELPA


From: Nicolas Petton
Subject: Re: [ANN] New library stream.el in ELPA
Date: Thu, 15 Oct 2015 09:38:28 +0200
User-agent: Notmuch/0.19 (http://notmuchmail.org) Emacs/25.0.50.7 (x86_64-unknown-linux-gnu)

Michael Heerdegen <address@hidden> writes:

> I tried this stress test with your lib:
>
> --8<---------------cut here---------------start------------->8---
> (defun stream-append (s1 s2)
>   (if (stream-empty-p s1) s2
>       (stream-cons
>        (stream-first s1)
>        (stream-append (stream-rest s1) s2))))
>
> (seq-elt (stream-append
>           (stream (cl-loop for i from 1 to 100 collect i))
>           (seq-filter
>            #'cl-oddp
>            (stream-append
>             (stream (cl-loop for i from 1 to 50000 collect i))
>             (seq-map #'1+ (stream (cl-loop for i from 50001 to 100001 collect 
> i))))))
>          40000)
> --8<---------------cut here---------------end--------------->8---
>
> What can I say - it work well!

:-)

>
> BTW, is `stream-append' missing in your library, or should that be done
> via some `seq' function?

It could be done with `seq-concatenate', but it would not be lazy, and
would return a sequence (consuming the entire stream!).  Adding
`stream-append' would indeed make sense.

The repository is https://github.com/NicolasPetton/stream, if you want
to send me a patch.

Nico

Attachment: signature.asc
Description: PGP signature


reply via email to

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