Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] recursive variants
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sylvain Pogodalla <Sylvain.Pogodalla@x...>
Subject: Re: [Caml-list] converting a list to a Stream
Terrence Brannon wrote:
> 
> How does one convert a list to a stream?
> 
> # let c = [1; 2; 3 ];;
> val c : int list = [1; 2; 3]
> # Stream_of_list c;;
> Characters 0-16:
> Unbound constructor Stream_of_list
> # stream_of_list c;;
> Characters 0-14:
> Unbound value stream_of_list

To use a function defined for a module, you call it with the syntax :

Module.function arg

Here, you have :
# let l=[1; 2; 3 ];;
val l : int list = [1; 2; 3]
# Stream.of_list l;;
- : int Stream.t = <abstr>

Or, if you don't want to have to prefix the function with the module
name, you can open it :
# open Stream;;
# let l=[1; 2; 3 ];;
val l : int list = [1; 2; 3]
# of_list l;;

S.
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr