Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] looping recursion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-07-28 (01:35)
From: Brian Hurt <bhurt@s...>
Subject: Re: [Caml-list] looping recursion
On Tue, 27 Jul 2004 wrote:

> That's just not good !  I can't even use standard map without the
> stack blowing up ?  This is a Bad Thing (TM).

Take a look at ExtLib:

This contains a drop-in compatible replacement to the List library, which 
includes a function that doesn't blow up.

If your list is that long, I'd actually recommend doing one of two things:

1) Switch off your list data structure for a more complicated data 
structure, like a Set.  If you do any sort of complicated access 
patterns, this will likely be a big win, or

2) If you only ever need to iterate through the list (and thus have simple 
access requirements), consider switching over to using an ExtLib style 
enum (same basic concept as Java's Iterator class).  This allows you do 
"wavefront" processing- apply the map to the list items as you read them 

Very long lists are a sign that you're using the wrong data structure.

"Usenet is like a herd of performing elephants with diarrhea -- massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it."
                                - Gene Spafford 

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: