[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: |
Wed, 14 Oct 2015 18:20:06 +0200 |
User-agent: |
Notmuch/0.19 (http://notmuchmail.org) Emacs/25.0.50.7 (x86_64-unknown-linux-gnu) |
John Wiegley <address@hidden> writes:
> How bizarre, just yesterday I started a file called "thunks.el" to generalize
> this kind of behavior. Since I didn't get very far, I'm glad to see the idea
> taking shape elsewhere!
>
> What I wonder is, can you generalize this beyond cons cells? I mean, can we
> have a general lazy evaluation framework, instead of just lazy lists? The API
> I was thinking of was:
>
> (let ((x (thunk-create FORM)))
> (thunk-eval x))
>
> The idea being that 'x' is a self-modifying thunk which only evaluates FORM
> the first time it is forced, but immediately returns the result value after.
>
> I think that stream-cons and seq-take could be implemented on top of this
> lower-level behavior.
stream.el is based on lazy form evaluation with memoization (which is
exactly what you describe IIUC), that I didn't need to expose it so I
kept it private to the library, see `stream--delay' and `stream-force':
https://github.com/NicolasPetton/stream/blob/master/stream.el#L62
Nico
signature.asc
Description: PGP signature
- [ANN] New library stream.el in ELPA, Nicolas Petton, 2015/10/15
- Re: [ANN] New library stream.el in ELPA, John Wiegley, 2015/10/14
- Re: [ANN] New library stream.el in ELPA,
Nicolas Petton <=
- Re: [ANN] New library stream.el in ELPA, John Wiegley, 2015/10/14
- Re: [ANN] New library stream.el in ELPA, Nicolas Petton, 2015/10/14
- Re: [ANN] New library stream.el in ELPA, John Wiegley, 2015/10/15
- Re: [ANN] New library stream.el in ELPA, Nicolas Petton, 2015/10/14
- Re: [ANN] New library stream.el in ELPA, raman, 2015/10/14
- Re: [ANN] New library stream.el in ELPA, John Wiegley, 2015/10/14
- Re: [ANN] New library stream.el in ELPA, Daniel Colascione, 2015/10/18
- Re: [ANN] New library stream.el in ELPA, Stephen J. Turnbull, 2015/10/19
- Re: [ANN] New library stream.el in ELPA, John Wiegley, 2015/10/20
- Re: [ANN] New library stream.el in ELPA, Stephen J. Turnbull, 2015/10/20