[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: general lazy list facility for Emacs Lisp?
From: |
Thierry Volpiatto |
Subject: |
Re: general lazy list facility for Emacs Lisp? |
Date: |
Wed, 23 Mar 2011 18:46:16 +0100 |
User-agent: |
Gnus/5.110016 (No Gnus v0.16) Emacs/23.3.50 (gnu/linux) |
Hi Ted,
Ted Zlatanov <address@hidden> writes:
> On Wed, 23 Mar 2011 17:45:35 +0100 Tassilo Horn <address@hidden> wrote:
>
> TH> Ted Zlatanov <address@hidden> writes:
>>> Is there a package for general lazy list management in Emacs Lisp?
>
> TH> What's a lazy list? Something like a LazySeq in Clojure, that is, a
> TH> possibly infinite sequence of things that are only calculated when
> TH> actually consumed ("realized")?
>
> TH> If that's what you mean, I think the answer is no.
>
> Yes, that's what I mean. In Haskell such lists are simply part of the
> core language; Perl 5 can hack them together with list accessors; Perl 6
> has them in the core too... I think "lazy list" is a popular term for
> the general facility? I'm surprised no one has needed them, whatever
> the name :)
Not sure to understand what you want, but maybe have a look at some
ioccur.el functions:
--8<---------------cut here---------------start------------->8---
ELISP> (setq A '(a b c d))
(a b c d)
ELISP> (setq it (ioccur-iter-circular A))
[...]
ELISP> (ioccur-iter-next it)
a
ELISP> (ioccur-iter-next it)
b
ELISP> (ioccur-iter-next it)
c
ELISP> (ioccur-iter-next it)
d
ELISP> (ioccur-iter-next it)
a
ELISP> (ioccur-iter-next it)
b
ELISP> (ioccur-iter-next it)
c
ELISP> (ioccur-iter-next it)
d
ELISP> (ioccur-iter-next it)
a
--8<---------------cut here---------------end--------------->8---
etc...etc...
> Slightly related: is there a general memoization package or standard
> approach to memoizing functions?
>
> Ted
>
>
>
--
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
- general lazy list facility for Emacs Lisp?, Ted Zlatanov, 2011/03/23
- Re: general lazy list facility for Emacs Lisp?, Tassilo Horn, 2011/03/23
- Re: general lazy list facility for Emacs Lisp?, Tassilo Horn, 2011/03/23
- Re: general lazy list facility for Emacs Lisp?, Ted Zlatanov, 2011/03/23
- Re: general lazy list facility for Emacs Lisp?, Eric Schulte, 2011/03/24
- Re: general lazy list facility for Emacs Lisp?, Ted Zlatanov, 2011/03/24
- Re: general lazy list facility for Emacs Lisp?, Eric Schulte, 2011/03/25