Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] lazy lists

6 views
Skip to first unread message

Yitzhak Mandelbaum

unread,
May 1, 2007, 10:12:31 AM5/1/07
to caml...@inria.fr
Hi,

Does anyone have/know of a lazy list module for ocaml? I couldn't
find anything on the hump.

Thanks!
Yitzhak

--------------------------------------------------
Yitzhak Mandelbaum
AT&T Labs - Research

http://www.research.att.com/~yitzhak


Loup Vaillant

unread,
May 1, 2007, 11:48:23 AM5/1/07
to caml...@inria.fr
2007/5/1, Yitzhak Mandelbaum <yit...@research.att.com>:

> Hi,
>
> Does anyone have/know of a lazy list module for ocaml? I couldn't find
> anything on the hump.

The equivalent is the functionnal streams, describe briefly in the
camlp4 manual.

Another possibilty is to code it yourself. I think you can imitate
most of the List module code.

Regards,
Loup

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Jon Harrop

unread,
May 1, 2007, 3:50:14 PM5/1/07
to caml...@yquem.inria.fr
On Tuesday 01 May 2007 16:47, Loup Vaillant wrote:
> The equivalent is the functionnal streams, describe briefly in the
> camlp4 manual.

Aren't ocaml stream destructive?

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
The F#.NET Journal
http://www.ffconsultancy.com/products/fsharp_journal/?e

Nicolas Pouillard

unread,
May 2, 2007, 3:17:53 AM5/2/07
to Jon Harrop
On 5/1/07, Jon Harrop <j...@ffconsultancy.com> wrote:
> On Tuesday 01 May 2007 16:47, Loup Vaillant wrote:
> > The equivalent is the functionnal streams, describe briefly in the
> > camlp4 manual.
>
> Aren't ocaml stream destructive?

Yes they are.

--
Nicolas Pouillard

Loup Vaillant

unread,
May 2, 2007, 6:05:50 AM5/2/07
to Caml mailing list
2007/5/2, Nicolas Pouillard <nicolas....@gmail.com>:

> On 5/1/07, Jon Harrop <j...@ffconsultancy.com> wrote:
> > On Tuesday 01 May 2007 16:47, Loup Vaillant wrote:
> > > The equivalent is the functionnal streams, describe briefly in the
> > > camlp4 manual.
> >
> > Aren't ocaml stream destructive?
>
> Yes they are.

Regular streams are destructive. I was talking about "functional"
ones. I didn't try them myself, but the manual says one can perform
left recursion with them (thanks to their non destructive nature).
Mind the pattern matching, though: it is quite different from the one
used with regular streams.

the syntax looks like:

let f s = match s with fparser (* and not just 'parser' *)
..

If I remember well.

Loup Vaillant

Daniel de Rauglaudre

unread,
May 2, 2007, 6:17:40 AM5/2/07
to caml...@inria.fr
Hi,

On Wed, May 02, 2007 at 12:03:29PM +0200, Loup Vaillant wrote:

> Regular streams are destructive. I was talking about "functional"
> ones. I didn't try them myself, but the manual says one can perform
> left recursion with them (thanks to their non destructive nature).

Use camlp4s : the library "fstream" and the syntax extension "pa_fstream"
are still there. Access and download from my home page below.

--
Daniel de Rauglaudre
http://pauillac.inria.fr/~ddr/index-english.html

0 new messages