emacs-devel
[Top][All Lists]
Advanced

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

Re: streams are cool, you could stream virtually anything!


From: Nicolas Petton
Subject: Re: streams are cool, you could stream virtually anything!
Date: Fri, 06 Nov 2015 16:33:38 +0100
User-agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/25.0.50.1 (x86_64-unknown-linux-gnu)

John Wiegley <address@hidden> writes:

> Hi Nicolas,

Hi John,

> A rich source of ideas could come from looking at the streaming libraries of
> other languages, like SERIES in Common Lisp, or conduit in Haskell. To give
> just a few ideas of what might arise from such research:
>
>     stream-take N STR
>
>         Produce a stream composed of up to the first N elements of STR.
>
>     stream-drop N STR
>
>         Produce a stream starting after the first N elements of STR.
>
>         stream-cdr = stream-drop 1
>
>     stream-apply #'FUNC STR1.. STRN
>
>         Given a function, reads its arguments from STR1.. STRN, and #'apply
>         the function to those arguments. Its result is the corresponding
>         element of the resulting stream. Continue until one of the argument
>         streams reaches its end.
>
>         stream-zip = stream-apply #'cons

Just to be sure, have you seen that streams are "seq"-eables? It means
that `seq-take', `seq-drop', `seq-map', `seq-filter', `seq-reduce',
etc. all work on streams (with lazy evaluation as well of course).

Some of the functions you mentioned are nice though.

Nico

Attachment: signature.asc
Description: PGP signature


reply via email to

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