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: Luca Pascali <pasckosky2000@y...>
Subject: [Caml-list] Recursive lists
Hi everyone.

I have a little question about the recursive lists.
In an application I needed to use a list composed by some elements 
(placed in the head of the list) and recursive element, like

let rec_list =
    let rec l2 = 100 :: l2 in
       [1;2;3;4;5] @ l2

in order to have the last elements periodically repeated.
In a list like this, I found that the map function goes in stack 
overflow. It seems that it is not aware of the recursive characteristics 
of the input list.
I had to write a version of the map function to support this in my 
software (I have to finalize something before posting it).

My questions are:
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


-- 
*********************************************************************
Luca Pascali
pasckosky2000@yahoo.it
luca@barettadeit.com
asxcaml-guru@barettadeit.com

http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. 02 370 111 55
fax. 02 370 111 54

Our technology:
http://www.asxcaml.org/
http://www.freerp.org/

-------------------
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