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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: james woodyatt <jhw@w...>
Subject: Re: [Caml-list] Recursive lists
On 08 Oct 2004, at 07:05, Sébastien Furic wrote:
> Luca Pascali wrote:
>> Can some functions of the List library support the use of the 
>> recursive lists?
>> I mean: can some scanning functions such as map, for_all, exists, 
>> mem, filter, and so on understand if they are working on recursive 
>> lists and act correctly without going in buffer overflow or infinite 
>> loops?
>> Did anyone already have a similar needing? And in which way did 
>> he/she work?
>> Thanks in advance to anyone
>> Luca
>
>  You can use lazy lists to solve the problem. A lazy list delivers its 
> elements on demand so you can manipulate infinite lists safely 
> provided you don't print their whole contents for instance...
>  See http://caml.inria.fr/archives/200304/msg00280.html to see how to 
> implement them (they're not present in the OCaml distribution).

My Cf library (in the OCNAE project on SF.Net) contains a full suite of 
functions for constructing and manipulating lazy lists (the Cf_seq 
module).  It also contains lots of other goodies.  The code has BSD 
license, is documented with Ocamldoc, and has no dependencies on 
anything other than Markus Mottl's Ocamlfind (for building and 
installing).

	<http://sf.net/projects/ocnae/>

(Note: you can even print the contents of an infinite lazy list if it's 
the last thing your program does before it receives SIGINT or SIGTERM, 
e.g. when printing to a pipe connected to the input of another 
program.)


-- 
j h woodyatt <jhw@wetware.com>
markets are only free to the people who own them.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners