Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Streams
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Error404  
View profile  
 More options Aug 10 2006, 6:57 am
Newsgroups: fa.caml
From: Error404 <erro...@tlen.pl>
Date: Thu, 10 Aug 2006 10:57:59 UTC
Local: Thurs, Aug 10 2006 6:57 am
Subject: [Caml-list] Streams
Hi,

I'm looking for some streams related tutorial or any other info.
By stream i mean something like this (I don't know exact definition):

open Lazy;;
type 'a stream = Nil | Cons of 'a Lazy.t * 'a stream Lazy.t;;

(* For example stream of 'integers from x' would look like this: *)

let rec intsfrom x =
  Cons(lazy x,lazy (intsfrom (x+1)));;

If you know any www/book or anything on this kind of streams please mail me (erro...@tlen.pl).
Many thanks.

_______________________________________________
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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Roewen  
View profile  
 More options Aug 10 2006, 7:46 am
Newsgroups: fa.caml
From: "Jonathan Roewen" <jonathan.roe...@gmail.com>
Date: Thu, 10 Aug 2006 11:46:04 UTC
Local: Thurs, Aug 10 2006 7:46 am
Subject: Re: [Caml-list] Streams
The Stream module provides exactly this functionality.

With camlp4o, you can use the old parser syntax too.

#load "camlp4o.cma";

let rec enum_from n = [< 'n; enum_from (n + 1) >];;

let first_10 = Stream.npeek 10 (enum_from 1);;

Streams are also lazily evaluated. More complex examples can be had
too, and there is the parser keyword to deconstruct streams as well.
You should be able to find more info in the camlp4 manual at the caml
site.

Jonathan

On 8/10/06, Error404 <erro...@tlen.pl> wrote:

_______________________________________________
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

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Jambon  
View profile  
 More options Aug 10 2006, 2:36 pm
Newsgroups: fa.caml
From: Martin Jambon <martin1...@laposte.net>
Date: Thu, 10 Aug 2006 18:36:19 UTC
Local: Thurs, Aug 10 2006 2:36 pm
Subject: Re: [Caml-list] Streams

I call this a lazy list. Anyway, I use the following definition:

   type 'a l = Empty | Cons of 'a * 'a t
   and 'a t = 'a l lazy_t   (* only one lazy object per cell *)

See attachment for the full implementation.

You can manipulate such lists like real lists, only the syntax is less
comfortable. They are different from streams in the sense of the standard
Stream module, which are mutable.

Martin

--
Martin Jambon, PhD
http://martin.jambon.free.fr

  lizt.ml
2K Download

_______________________________________________
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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris King  
View profile  
 More options Aug 10 2006, 3:05 pm
Newsgroups: fa.caml
From: "Chris King" <colander...@gmail.com>
Date: Thu, 10 Aug 2006 19:05:14 UTC
Local: Thurs, Aug 10 2006 3:05 pm
Subject: Re: [Caml-list] Streams
On 8/10/06, Jonathan Roewen <jonathan.roe...@gmail.com> wrote:

> The Stream module provides exactly this functionality.

Don't forget about Fstream
(http://caml.inria.fr/pub/docs/manual-camlp4/manual008.html#toc30); it
does the same thing as Stream but in a functional manner (and with a
similar syntax, pa_fstream.cmo).

_______________________________________________
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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jon Harrop  
View profile  
 More options Aug 10 2006, 8:05 pm
Newsgroups: fa.caml
From: Jon Harrop <j...@ffconsultancy.com>
Date: Fri, 11 Aug 2006 00:05:39 UTC
Local: Thurs, Aug 10 2006 8:05 pm
Subject: Re: [Caml-list] Streams
On Thursday 10 August 2006 11:51, Error404 wrote:

> I'm looking for some streams related tutorial or any other info.
> By stream i mean something like this (I don't know exact definition):

> open Lazy;;
> type 'a stream = Nil | Cons of 'a Lazy.t * 'a stream Lazy.t;;

> (* For example stream of 'integers from x' would look like this: *)

> let rec intsfrom x =
>   Cons(lazy x,lazy (intsfrom (x+1)));;

> If you know any www/book or anything on this kind of streams please mail me
> (erro...@tlen.pl). Many thanks.

I just posted a link to some stuff on streams in the context of parsing but
you can write intsfrom as:

# #load "camlp4o.cma";;
        Camlp4 Parsing version 3.09.2

# let rec intsfrom n = [< 'n; intsfrom(n+1) >];;

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists

_______________________________________________
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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »