[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ANN] New library stream.el in ELPA
From: |
John Wiegley |
Subject: |
Re: [ANN] New library stream.el in ELPA |
Date: |
Wed, 14 Oct 2015 09:09:05 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) |
>>>>> Nicolas Petton <address@hidden> writes:
> Here is an example implementation of the Fibonacci numbers implemented as in
> infinite stream:
> (defun fib (a b)
> (stream-cons a (fib b (+ a b))))
> (fib 0 1)
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.
John
- [ANN] New library stream.el in ELPA, Nicolas Petton, 2015/10/15
- Re: [ANN] New library stream.el in ELPA,
John Wiegley <=
- 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/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