unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: John Wiegley <jwiegley@gmail.com>
To: Nicolas Petton <nicolas@petton.fr>
Cc: Michael Heerdegen <michael_heerdegen@web.de>,
	emacs-devel <emacs-devel@gnu.org>,
	bruce.connor.am@gmail.com, raman <raman@google.com>
Subject: Re: streams are cool, you could stream virtually anything!
Date: Thu, 05 Nov 2015 21:08:32 -0500	[thread overview]
Message-ID: <m24mgzlw0v.fsf@newartisans.com> (raw)
In-Reply-To: <877flwl7ee.fsf@web.de> (Michael Heerdegen's message of "Thu, 05 Nov 2015 17:48:09 +0100")

Hi Nicolas,

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
    
    stream-apply* #'FUNC STR1.. STRN

        Like stream-apply, but any exhausted argument stream is seen to return
        nil until all are exhausted.

    stream-iterate FUNC VAL

        Produce a stream by funcall'ing FUNC on VAL to determine the first
        element, then funcall FUNC on that result to produce the next element,
        so on until infinity.

    stream-isolate N STR

        Ensure a resulting stream that is exactly N elements long. This is
        like stream-take if STR is longer, otherwise it's like appending N-M
        nil values onto STR, where M is the actual length.

    stream-append STR1 STR2

        Concatenate two streams, producing a longer one.

    stream-loop

        This is a macro wrapper around `loop' that adds a new keyword:
        streaming. Like collect, except it collects the results in a stream
        instead of a list.

    stream-list LIST

        Make a list look like a stream (i.e., accessible using the stream
        API).

    stream-collect STR

        Drain all the elements of STR into a list.

    stream-repeat N VAL

        A stream consisting of VAL repeated N times.

This list could easily be many times as long... For more inspiration see:

    http://hackage.haskell.org/package/conduit-combinators-1.0.3/docs/Conduit.html

If you'd like me continue, just say. I've written libraries similar to this
before, just not in Emacs Lisp (and it's awesome that it's becoming easy to!).

John
        



  parent reply	other threads:[~2015-11-06  2:08 UTC|newest]

Thread overview: 209+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04 12:39 streams are cool, you could stream virtually anything! Nicolas Petton
2015-11-04 15:50 ` John Wiegley
2015-11-04 16:59   ` Damien Cassou
2015-11-04 18:06   ` Michael Heerdegen
2015-11-04 19:17     ` Michael Heerdegen
2015-11-04 21:58     ` Nicolas Petton
2015-11-04 23:20       ` T.V Raman
2015-11-04 23:31         ` Nicolas Petton
2015-11-05  0:27         ` John Wiegley
2015-11-05  0:38           ` T.V Raman
2015-11-05  0:48             ` ELPA policy (Was: streams are cool, you could stream virtually anything!) John Wiegley
2015-11-05  0:52               ` T.V Raman
2015-11-08 17:18               ` ELPA policy Achim Gratz
2015-11-08 17:49                 ` Eli Zaretskii
2015-11-08 20:52                   ` Aaron Ecay
2015-11-09  3:42                     ` Eli Zaretskii
2015-11-09  3:51                       ` Dmitry Gutov
2015-11-09 11:15                         ` New ELPA policy proposal (was: ELPA policy) Oleh Krehel
2015-11-09 13:51                           ` Artur Malabarba
2015-11-09 15:02                             ` New ELPA policy proposal Oleh Krehel
2015-11-09 16:22                               ` Artur Malabarba
2015-11-09 15:41                             ` Wolfgang Jenkner
2015-11-09 15:50                               ` Dmitry Gutov
2015-11-09 16:13                                 ` Wolfgang Jenkner
2015-11-09 21:50                                   ` Richard Stallman
2015-11-09 16:25                               ` Artur Malabarba
2015-11-09 16:11                           ` New ELPA policy proposal (was: ELPA policy) Eli Zaretskii
2015-11-10  7:26                             ` New ELPA policy proposal Oleh Krehel
2015-11-10 14:24                               ` John Wiegley
2015-11-10 16:36                                 ` Eli Zaretskii
2015-11-09 16:05                         ` ELPA policy Eli Zaretskii
2015-11-09 16:15                           ` Dmitry Gutov
2015-11-09 16:20                             ` Eli Zaretskii
2015-11-09 16:26                               ` Dmitry Gutov
2015-11-09 16:44                                 ` Eli Zaretskii
2015-11-09 17:46                                   ` Dmitry Gutov
2015-11-09 16:35                               ` Artur Malabarba
2015-11-09 19:52                               ` John Wiegley
2015-11-09 20:17                                 ` Achim Gratz
2015-11-09 21:38                                   ` John Wiegley
2015-11-10 20:07                                     ` Achim Gratz
2015-11-09 21:51                                 ` Richard Stallman
2015-11-09 22:06                                   ` John Wiegley
2015-11-09 23:05                                     ` Artur Malabarba
2015-11-10 18:18                                       ` Richard Stallman
2015-11-11 15:11                                         ` Nicolas Petton
2015-11-11 17:03                                           ` Richard Stallman
2015-11-09 23:47                                     ` Nicolas Petton
2015-11-09 23:44                                   ` Nicolas Petton
2015-11-09 23:42                                 ` Nicolas Petton
2015-11-09 23:52                                 ` Aaron Ecay
2015-11-10  0:04                                   ` John Wiegley
2015-11-10 18:06                                 ` Stephen Leake
     [not found]                                   ` <"<87lha5snji.fsf"@isaac.fritz.box>
     [not found]                                     ` <"<87d1vhsmuj.fsf"@isaac.fritz.box>
     [not found]                                       ` <"<878u65slue.fsf"@isaac.fritz.box>
     [not found]                                         ` <"<874mgtsjwn.fsf"@isaac.fritz.box>
2015-11-10 18:28                                   ` John Wiegley
2015-11-10 18:32                                     ` Dmitry Gutov
2015-11-10 18:35                                       ` John Wiegley
2015-11-10 18:44                                         ` David Engster
2015-11-10 18:49                                           ` John Wiegley
2015-11-10 20:00                                           ` Dmitry Gutov
2015-11-11 15:15                                             ` xref and GNU Global (Re: ELPA policy) Nicolas Petton
2015-11-11 15:22                                               ` Dmitry Gutov
2015-11-11 23:19                                                 ` Stephen Leake
2015-11-11 23:32                                                   ` Dmitry Gutov
2015-11-12  7:07                                                     ` Stephen Leake
2015-11-11 23:12                                               ` Stephen Leake
2015-11-11 23:52                                                 ` Nicolas Petton
2015-11-12  7:05                                                   ` Stephen Leake
2015-11-10 19:15                                         ` ELPA policy Eli Zaretskii
2015-11-10 22:44                                           ` xref CEDET (was ELPA policy) Stephen Leake
2015-11-10 21:52                                         ` ELPA policy Dmitry Gutov
2015-11-10 18:37                                       ` David Engster
2015-11-10 19:57                                         ` Dmitry Gutov
2015-11-10 20:01                                           ` Eli Zaretskii
2015-11-10 20:19                                             ` Dmitry Gutov
2015-11-10 20:34                                               ` Eli Zaretskii
2015-11-10 21:16                                                 ` Dmitry Gutov
2015-11-10 21:27                                                   ` Dmitry Gutov
2015-11-10 22:40                                               ` Stephen Leake
2015-11-10 20:45                                           ` David Engster
2015-11-10 21:07                                             ` Dmitry Gutov
2015-11-10 18:43                                     ` David Engster
2015-11-10 18:52                                       ` John Wiegley
2015-11-10 18:58                                         ` David Engster
2015-11-10 19:03                                           ` John Wiegley
2015-11-10 19:20                                             ` David Engster
2015-11-10 19:43                                               ` John Wiegley
2015-11-10 20:02                                                 ` David Engster
2015-11-10 20:24                                                   ` John Wiegley
2015-11-10 23:08                                                     ` Stephen Leake
2015-11-10 23:31                                                       ` John Wiegley
2015-11-11  0:32                                                         ` Drew Adams
2015-11-11  0:36                                                           ` John Wiegley
2015-11-11  9:25                                                             ` Stephen Leake
2015-11-11 13:52                                                               ` Filipp Gunbin
2015-11-11 21:22                                                                 ` Stephen Leake
2015-11-12 13:24                                                                   ` Filipp Gunbin
2015-11-12 17:11                                                                     ` John Wiegley
2015-11-12 19:17                                                                       ` Filipp Gunbin
2015-11-12 19:31                                                                         ` John Wiegley
2015-11-14 10:16                                                                         ` Stephen Leake
2015-11-12 19:52                                                                     ` Stephen Leake
2015-11-13 13:06                                                                       ` Filipp Gunbin
2015-11-14 10:30                                                                         ` Stephen Leake
2015-11-17 13:01                                                                           ` Filipp Gunbin
2015-11-17 16:18                                                                             ` Stephen Leake
2015-11-17 15:51                                                                           ` Tom Tromey
2015-11-11 17:02                                                               ` Richard Stallman
2015-11-11 17:24                                                                 ` John Wiegley
2015-11-12 14:02                                                                   ` Phillip Lord
2015-11-12 17:11                                                                     ` John Wiegley
2015-11-12 19:59                                                                     ` Stephen Leake
2015-11-13 21:58                                                                     ` Richard Stallman
2015-11-14  1:15                                                                       ` JJ Asghar
2015-11-14 17:23                                                               ` Jorge A. Alfaro-Murillo
2015-11-15 16:37                                                                 ` John Wiegley
     [not found]                                                             ` <<86bnb06g7g.fsf@stephe-leake.org>
     [not found]                                                               ` <<E1ZwYnH-0004b0-Gu@fencepost.gnu.org>
2015-11-11 17:47                                                                 ` Drew Adams
2015-11-11 19:23                                                                   ` John Wiegley
2015-11-11 19:58                                                                     ` Drew Adams
2015-11-11 23:27                                                                     ` Richard Stallman
2015-11-12  0:35                                                                       ` Artur Malabarba
2015-11-12  0:42                                                                         ` Dmitry Gutov
2015-11-12 22:34                                                                         ` Richard Stallman
2015-11-13  0:49                                                                           ` Artur Malabarba
2015-11-12  6:49                                                                       ` Stephen Leake
2015-11-12 15:09                                                                         ` Drew Adams
2015-11-12 17:29                                                                           ` Alex Schröder
2015-11-12 22:33                                                                         ` Richard Stallman
2015-11-14 10:33                                                                           ` Stephen Leake
2015-11-14 21:05                                                                             ` Richard Stallman
     [not found]                                                                       ` <<86oaezemp9.fsf@stephe-leake.org>
     [not found]                                                                         ` <<E1Zx0QR-0004QE-Ga@fencepost.gnu.org>
2015-11-12 23:05                                                                           ` Drew Adams
2015-11-13  7:51                                                                             ` Eli Zaretskii
2015-11-13 22:00                                                                             ` Richard Stallman
     [not found]                                                                             ` <<E1ZxMOr-0004hb-VH@fencepost.gnu.org>
2015-11-13 23:03                                                                               ` Drew Adams
2015-11-14  1:44                                                                                 ` Richard Stallman
2015-11-15  9:28                                                                                   ` Michael Heerdegen
2015-11-15 15:44                                                                                     ` Drew Adams
2015-11-17 22:55                                                                                       ` Richard Stallman
2015-11-17 23:17                                                                                         ` John Wiegley
2015-11-18  9:53                                                                                           ` Artur Malabarba
2015-11-18 10:12                                                                                             ` David Kastrup
2015-11-14  9:57                                                                                 ` Achim Gratz
     [not found]                                                                   ` <<m2twosgx1m.fsf@Vulcan.attlocal.net>
     [not found]                                                                     ` <<E1Zwent-0000bG-9i@fencepost.gnu.org>
2015-11-12  0:22                                                                       ` Drew Adams
2015-11-10 23:01                                                   ` Stephen Leake
2015-11-10 22:53                                                 ` Stephen Leake
2015-11-10 19:17                                         ` Eli Zaretskii
2015-11-10 23:10                                           ` Stephen Leake
2015-11-10 22:52                                         ` Stephen Leake
2015-11-10 18:49                                     ` Eli Zaretskii
2015-11-10 18:54                                       ` John Wiegley
2015-11-10 19:21                                         ` Eli Zaretskii
2015-11-10 19:26                                           ` Eli Zaretskii
2015-11-10 19:29                                             ` John Wiegley
2015-11-10 20:06                                           ` Dmitry Gutov
2015-11-10 23:25                                           ` Stephen Leake
2015-11-10 23:23                                         ` Stephen Leake
2015-11-10 20:03                                       ` Dmitry Gutov
2015-11-10 23:16                                       ` Stephen Leake
2015-11-10 22:36                                     ` Stephen Leake
2015-11-10 22:54                                       ` John Wiegley
2015-11-10 23:01                                         ` Drew Adams
2015-11-11  9:13                                           ` Stephen Leake
2015-11-11 14:58                                             ` Drew Adams
2015-11-09 18:22                       ` Achim Gratz
2015-11-09 18:45                         ` Eli Zaretskii
2015-11-09 18:58                           ` David Engster
2015-11-09 19:08                             ` Eli Zaretskii
2015-11-09 19:35                               ` David Engster
2015-11-09 20:12                                 ` Eli Zaretskii
2015-11-09 19:53                           ` Rasmus
2015-11-09 19:58                           ` Achim Gratz
2015-11-05 17:06           ` streams and generators (was: streams are cool, you could stream virtually anything!) Michael Heerdegen
2015-11-05 22:36             ` streams and generators Dmitry Gutov
2015-11-04 23:34       ` streams are cool, you could stream virtually anything! Michael Heerdegen
2015-11-05  9:27         ` Nicolas Petton
2015-11-05 11:26           ` Artur Malabarba
2015-11-05 11:52             ` Nicolas Petton
2015-11-05 16:31               ` raman
2015-11-05 16:48                 ` Michael Heerdegen
2015-11-05 21:58                   ` Nicolas Petton
2015-11-05 23:05                     ` Artur Malabarba
2015-11-05 23:34                       ` T.V Raman
2015-11-06  0:02                         ` Artur Malabarba
2015-11-06  0:39                           ` T.V Raman
2015-11-05 23:52                       ` Michael Heerdegen
2015-11-06  2:19                         ` John Wiegley
2015-11-06  2:47                           ` Michael Heerdegen
2015-11-06 15:09                             ` Filipp Gunbin
2015-11-06 10:49                           ` Nicolas Petton
2015-11-06 13:09                             ` Artur Malabarba
2015-11-06 13:43                               ` Nicolas Petton
2015-11-06 15:41                                 ` John Wiegley
2015-11-06 16:13                                   ` John Wiegley
2015-11-06 17:36                                   ` Nicolas Petton
2015-11-06 10:47                         ` Nicolas Petton
2015-11-06  2:08                   ` John Wiegley [this message]
2015-11-06 15:33                     ` Nicolas Petton
2015-11-06 16:08                       ` John Wiegley
2015-11-06 17:12                         ` Nicolas Petton
2015-11-05 23:06               ` Artur Malabarba
2015-11-05 14:12             ` Michael Heerdegen
2015-11-04 17:00 ` Phillip Lord
2015-11-04 22:00   ` Nicolas Petton
2015-11-05 12:28     ` Phillip Lord
2015-11-05 13:45       ` Nicolas Petton
2015-11-05 15:15         ` Michael Heerdegen
2015-11-05 16:35       ` Eli Zaretskii
2015-11-06  9:54         ` Phillip Lord
2015-11-04 17:57 ` Michael Heerdegen
2015-11-04 22:00   ` Nicolas Petton
     [not found] <<87ziyuaqhl.fsf@petton.fr>

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m24mgzlw0v.fsf@newartisans.com \
    --to=jwiegley@gmail.com \
    --cc=bruce.connor.am@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=nicolas@petton.fr \
    --cc=raman@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).